ecc_encryption 0.0.1
ecc_encryption: ^0.0.1 copied to clipboard
Elliptic curve cryptography functions in Dart. Private Key, Public Key, Encryption, Decryption
Elliptic curve cryptography (ECC) in Dart #
Elliptic curve cryptography lib for EOS based blockchain in Dart lang.
BitLength #
- Use
BitLength.aes16to apply128 bitAES encryption and decryption. - Use
BitLength.aes24to apply192 bitAES encryption and decryption. - Use
BitLength.aes32to apply256 bitAES encryption and decryption. - Default is
BitLength.aes32.
AES Padding #
PKCS5/ECBis the default padding mode.
Usage #
A simple usage example: #
class Example {
ECC ecc = ECC.initialise(wifPrivateKey: '<YOUR_WIF_PRIVATE_KEY>');
getKeys(){
print('Private Key: ${ecc.privateKey}');
print('Public Key: ${ecc.publicKey}');
encrypt();
}
encrypt(){
String message = 'Hello World';
String? encrypted = ecc.encrypt(data: message);
print('Encrypted: $encrypted');
print('Decrypted: ${decrypt(encrypted ?? '')}');
}
decrypt(String message){
return ecc.decrypt(data: message);
}
}
Sample Output #
Private Key: 5JaLPBezdxEV8vcYhzA27rFxda4JJiSneacnerYSPDoRt7K1ZEA
Public Key: EOS6obgFpmdbb2xNJHqoTStA4DMzDvNTwk1V255wz2AdjQTbiqKNs
Encrypted: do721rp9jGvQeavPmDw34A==
Decrypted: Hello World
References #
eosjs-ecc: https://github.com/EOSIO/eosjs-ecc
eos-encrypt: https://github.com/EOS-Nation/eos-encrypt
Notes #
In case you find any functionality is missing, please feel free to contact us.