Skip to content

Commit

Permalink
Merge branch '1.1.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyennv committed Oct 17, 2024
2 parents c0dc79b + 7278682 commit a4ca956
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
14 changes: 7 additions & 7 deletions lib/src/crypto/math/int_ext.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import 'dart:typed_data';

import 'package:fixnum/fixnum.dart';
const _mask32 = 0xffffffff;

/// Author Nguyen Van Nguyen <[email protected]>
extension IntExt on int {
Expand Down Expand Up @@ -43,20 +43,20 @@ extension IntExt on int {
}

int shiftLeft32(final int n) {
return (Int64(toUnsigned(32)) << n).toInt();
return (this & _mask32) << n;
}

int shiftRight32(final int n) {
return (Int64(toUnsigned(32)) >> n).toInt();
return (this & _mask32) >> n;
}

int rotateLeft32(final int n) {
final num = Int64(toUnsigned(32));
return ((num << n) + (num >> (32 - n))).toInt();
final num = this & _mask32;
return (num << n) | (num >> 32 - n);
}

int rotateRight32(final int n) {
final num = Int64(toUnsigned(32));
return ((num >> n) + (num << (32 - n))).toInt();
final num = this & _mask32;
return (num >> n) | (num << 32 - n);
}
}
1 change: 0 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ environment:
sdk: ^3.2.0

dependencies:
fixnum: ^1.1.0
pinenacl: ^0.6.0
pointycastle: ^3.9.1

Expand Down

0 comments on commit a4ca956

Please sign in to comment.