Skip to content

Commit

Permalink
fix param check for sign
Browse files Browse the repository at this point in the history
for more info, see
google/protobuf.dart#269
  • Loading branch information
mavis.tan committed Aug 2, 2019
1 parent 1fc349f commit 59a86d3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
10 changes: 5 additions & 5 deletions lib/__generated__/proto/transaction.pb.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 11 additions & 2 deletions lib/src/ed25519_dart_base.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import 'dart:math' show Random, pow;
import 'dart:typed_data' show Uint8List;

import 'package:hex/hex.dart';
import 'package:pointycastle/pointycastle.dart' show Digest;

String digestIdentifier = 'SHA-512';
Expand Down Expand Up @@ -43,8 +43,9 @@ final ONE = BigInt.from(1);
/// var l = new List<int>.generate(32, (int i) => i + i); // [0, ..., 60, 62]
/// bitClamp(new Uint8List.fromList(l)); // [0, ..., 60, 126]
Uint8List bitClamp(Uint8List bytes) {
bytes = bytes.sublist(0, 32);
bytes[0] &= 248;
bytes[31] &= 63;
bytes[31] &= 127;
bytes[31] |= 64;
return bytes;
}
Expand Down Expand Up @@ -202,6 +203,14 @@ Uint8List secretKey([int seed]) {
return clamped;
}

Uint8List hexToBytes(String hex) {
return Uint8List.fromList(HEX.decode(hex));
}

String byteToHex(Uint8List bytes) {
return HEX.encode(bytes).toUpperCase();
}

/// Creates signature for message [message] by using secret key [secretKey]
/// and public key [pubKey].
/// Signature is [Uint8List] with size 64.
Expand Down

0 comments on commit 59a86d3

Please sign in to comment.