Add pbkdf2 digest sh512
This commit is contained in:
parent
46b1a5248c
commit
03beb35dbc
@ -52,7 +52,7 @@ class _MyAppState extends State<MyApp> {
|
|||||||
if (password.isEmpty) {
|
if (password.isEmpty) {
|
||||||
output = 'Password is empty';
|
output = 'Password is empty';
|
||||||
} else {
|
} else {
|
||||||
key = await KeyGenerator().pbkdf2(password, 'salt', digest: Digest.sha1);
|
key = await KeyGenerator().pbkdf2(password, 'salt', digest: Digest.sha512);
|
||||||
output = 'Key successfully derived.';
|
output = 'Key successfully derived.';
|
||||||
}
|
}
|
||||||
setState(() {
|
setState(() {
|
||||||
|
@ -16,7 +16,7 @@ const String TAG_DEBUG = 'debug.native_crypto.symmetric_crypto';
|
|||||||
enum KeySize { bits128, bits192, bits256 }
|
enum KeySize { bits128, bits192, bits256 }
|
||||||
|
|
||||||
/// Defines all available digest.
|
/// Defines all available digest.
|
||||||
enum Digest { sha1, sha256 }
|
enum Digest { sha1, sha256, sha512 }
|
||||||
|
|
||||||
/// Defines all available ciphers.
|
/// Defines all available ciphers.
|
||||||
enum Cipher { AES }
|
enum Cipher { AES }
|
||||||
@ -68,6 +68,7 @@ class KeyGenerator {
|
|||||||
String algo;
|
String algo;
|
||||||
if (digest == Digest.sha1) algo = 'sha1';
|
if (digest == Digest.sha1) algo = 'sha1';
|
||||||
if (digest == Digest.sha256) algo = 'sha256';
|
if (digest == Digest.sha256) algo = 'sha256';
|
||||||
|
if (digest == Digest.sha512) algo = 'sha512';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
key = await NativeCrypto().pbkdf2( password, salt, keyLength: keyLength, iteration: iteration, algorithm: algo);
|
key = await NativeCrypto().pbkdf2( password, salt, keyLength: keyLength, iteration: iteration, algorithm: algo);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user