crypto library

Exports low-level cryptographic operations needed to sign Core transactions.

Properties

ed448Wallet → Ed448HDWallet
final
sha3digest → SHA3Digest
final

Functions

bytesToHex(List<int> bytes, {bool include0x = false, int? forcePadLength, bool padToEvenLength = false}) String
Converts the bytes given as a list of integers into a hexadecimal representation.
bytesToInt(List<int> bytes) BigInt
Converts the bytes from that list (big endian) to a (potentially signed) BigInt.
bytesToUnsignedInt(Uint8List bytes) BigInt
calculateCheckSum(Uint8List address, Uint8List prefix) String
ecRecover(Uint8List signedMessage) Uint8List
Given an arbitrary core blockchain message signature encoded in bytes, returns the public key that was used to sign it. https://github.com/web3j/web3j/blob/c0b7b9c2769a466215d416696021aa75127c2ff1/crypto/src/main/java/org/web3j/crypto/Sign.java#L241
generateNewPrivateKey(String seed, int index) Uint8List
Generates a new private key using the seed. Please make sure you're using a cryptographically secure generator.
getNetworkIdPrefix(int networkId) String
hexHasPrefix(String hex) bool
checks if hex has 0x prefix
hexToBytes(String hexStr) Uint8List
Converts the hexadecimal string, which can be prefixed with 0x, to a byte sequence.
hexToDartInt(String hex) int
Converts the hexadecimal input and creates an int.
hexToInt(String hex) BigInt
Takes the hexadecimal input and creates a BigInt.
intToBytes(BigInt number) Uint8List
isValidSignature(Uint8List messageHash, Uint8List signedMsg, Uint8List publicKey) bool
Given an arbitrary message hash, an Core Block Chain message signature encoded in bytes and a public key encoded in bytes, confirms whether that public key was used to sign the message or not.
privateKeyBytesToPublic(Uint8List privateKey) Uint8List
Generates a public key for the given private key using the ed448 curve which core blockchain uses.
privateKeyToPublic(BigInt privateKey) Uint8List
Generates a public key for the given private key using the ecdsa curve which core blockchain uses.
publicKeyToAddress(Uint8List publicKey, int networkId) Uint8List
Constructs the core blockchain address associated with the given public key by taking the lower 160 bits of the key's sha3 hash.
sha3_256(Uint8List input) Uint8List
sha3Ascii(String input) Uint8List
sha3Utf8(String input) Uint8List
signWithPrivKey(Uint8List messageHash, Uint8List privateKey) Uint8List
Signs the hashed data in messageHash using the given private key, also concats the public key at the end.
strip0x(String hex) String
If present, removes the 0x from the start of a hex-string.
unsignedIntToBytes(BigInt number) Uint8List