-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- New class: `Bcrypt` - New methods: `bcrypt`, `bcryptSalt`, `bcryptVerify`, `bcryptDigest` Other changes: - Convert all asUint...List to Uint...List.view - Refactor: `Argon2.fromEncoded` will now accept `CryptData` only. - New method: `Argon2Context.fromEncoded` accepting `CryptData`.
- Loading branch information
Showing
24 changed files
with
1,729 additions
and
339 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright (c) 2024, Sudipto Chandra | ||
// All rights reserved. Check LICENSE file for details. | ||
|
||
import 'dart:math'; | ||
|
||
import 'package:hashlib/hashlib.dart'; | ||
|
||
import 'base.dart'; | ||
|
||
Random random = Random(); | ||
|
||
class HashlibBenchmark extends KDFBenchmarkBase { | ||
final salt = randomBytes(16); | ||
final BcryptSecurity security; | ||
final password = 'long password'.codeUnits; | ||
|
||
HashlibBenchmark(this.security) : super('hashlib'); | ||
|
||
@override | ||
void run() { | ||
bcryptDigest(password, salt: salt, security: security); | ||
} | ||
} | ||
|
||
void main() { | ||
double runtime; | ||
print('--------- Hashlib/BCRYPT ----------'); | ||
runtime = HashlibBenchmark(BcryptSecurity.test).measure(); | ||
print('hashlib/bcrypt[test]: ${runtime / 1000} ms'); | ||
runtime = HashlibBenchmark(BcryptSecurity.little).measure(); | ||
print('hashlib/bcrypt[little]: ${runtime / 1000} ms'); | ||
runtime = HashlibBenchmark(BcryptSecurity.moderate).measure(); | ||
print('hashlib/bcrypt[moderate]: ${runtime / 1000} ms'); | ||
runtime = HashlibBenchmark(BcryptSecurity.good).measure(); | ||
print('hashlib/bcrypt[good]: ${runtime / 1000} ms'); | ||
runtime = HashlibBenchmark(BcryptSecurity.strong).measure(); | ||
print('hashlib/bcrypt[strong]: ${runtime / 1000} ms'); | ||
print(''); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.