-
-
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.
- Loading branch information
Showing
13 changed files
with
127 additions
and
61 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,3 +1,7 @@ | ||
# 1.18.1 | ||
|
||
- Fix import issue for _web_ platform. | ||
|
||
# 1.18.0 | ||
|
||
- Implement BCrypt algorithm. | ||
|
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
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,54 @@ | ||
// Copyright (c) 2024, Sudipto Chandra | ||
// All rights reserved. Check LICENSE file for details. | ||
|
||
import 'dart:async'; | ||
import 'dart:io'; | ||
import 'dart:typed_data'; | ||
|
||
import 'hash_base.dart'; | ||
import 'hash_digest.dart'; | ||
|
||
extension HashBaseFileSupport on HashBase { | ||
/// Converts the [input] file and returns a [HashDigest] asynchronously. | ||
/// | ||
/// If [start] is present, the file will be read from byte-offset [start]. | ||
/// Otherwise from the beginning (index 0). | ||
/// | ||
/// If [end] is present, only bytes up to byte-index [end] will be read. | ||
/// Otherwise, until end of file. | ||
@pragma('vm:prefer-inline') | ||
Future<HashDigest> file(File input, [int start = 0, int? end]) { | ||
return bind(input.openRead(start, end)).first; | ||
} | ||
|
||
/// Converts the [input] file and returns a [HashDigest] synchronously. | ||
/// | ||
/// If [start] is present, the file will be read from byte-offset [start]. | ||
/// Otherwise from the beginning (index 0). | ||
/// | ||
/// If [end] is present, only bytes up to byte-index [end] will be read. | ||
/// Otherwise, until end of file. | ||
/// | ||
/// If [bufferSize] is present, the file will be read in chunks of this size. | ||
/// By default the [bufferSize] is `2048`. | ||
HashDigest fileSync( | ||
File input, { | ||
int start = 0, | ||
int? end, | ||
int bufferSize = 2048, | ||
}) { | ||
var raf = input.openSync(); | ||
try { | ||
var sink = createSink(); | ||
var buffer = Uint8List(bufferSize); | ||
int length = end ?? raf.lengthSync(); | ||
for (int i = start, l; i < length; i += l) { | ||
l = raf.readIntoSync(buffer); | ||
sink.add(buffer, 0, l); | ||
} | ||
return sink.digest(); | ||
} finally { | ||
raf.closeSync(); | ||
} | ||
} | ||
} |
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,40 @@ | ||
// Copyright (c) 2024, Sudipto Chandra | ||
// All rights reserved. Check LICENSE file for details. | ||
|
||
import 'dart:async'; | ||
|
||
import 'hash_base.dart'; | ||
import 'hash_digest.dart'; | ||
|
||
extension HashBaseFileSupport on HashBase { | ||
/// Converts the [input] file and returns a [HashDigest] asynchronously. | ||
/// | ||
/// If [start] is present, the file will be read from byte-offset [start]. | ||
/// Otherwise from the beginning (index 0). | ||
/// | ||
/// If [end] is present, only bytes up to byte-index [end] will be read. | ||
/// Otherwise, until end of file. | ||
@pragma('vm:prefer-inline') | ||
Future<HashDigest> file(input, [int start = 0, int? end]) { | ||
throw UnsupportedError('Unavailable for this platform'); | ||
} | ||
|
||
/// Converts the [input] file and returns a [HashDigest] synchronously. | ||
/// | ||
/// If [start] is present, the file will be read from byte-offset [start]. | ||
/// Otherwise from the beginning (index 0). | ||
/// | ||
/// If [end] is present, only bytes up to byte-index [end] will be read. | ||
/// Otherwise, until end of file. | ||
/// | ||
/// If [bufferSize] is present, the file will be read in chunks of this size. | ||
/// By default the [bufferSize] is `2048`. | ||
HashDigest fileSync( | ||
input, { | ||
int start = 0, | ||
int? end, | ||
int bufferSize = 2048, | ||
}) { | ||
throw UnsupportedError('Unavailable for this platform'); | ||
} | ||
} |
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
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