2024-08-29 18:46:56 -07:00
|
|
|
import 'dart:typed_data';
|
|
|
|
|
|
|
|
import 'package:libac_dart/nbt/Stream.dart';
|
2024-05-24 14:36:51 -07:00
|
|
|
import 'package:libac_dart/utils/Hashing.dart';
|
|
|
|
import 'package:test/expect.dart';
|
|
|
|
import 'package:test/scaffolding.dart';
|
2024-05-16 02:59:10 -07:00
|
|
|
|
|
|
|
void main() {
|
|
|
|
test("Test md5", () {
|
|
|
|
expect(Hashing.md5Hash("Hello World"), "b10a8db164e0754105b7a99be72e3fe5");
|
|
|
|
});
|
2024-08-29 16:25:28 -07:00
|
|
|
|
|
|
|
test("Test sha256", () {
|
2024-08-29 18:46:56 -07:00
|
|
|
Uint8List hsh = Uint8List.fromList(Hashing.sha256Sum([0x0A, 0x0B]));
|
|
|
|
print("Sha256 Length: ${hsh.lengthInBytes}");
|
|
|
|
|
|
|
|
ByteLayer layer = ByteLayer();
|
|
|
|
layer.writeBytes(hsh);
|
|
|
|
print("Layer length: ${layer.bytes.lengthInBytes}");
|
2024-08-29 16:25:28 -07:00
|
|
|
|
|
|
|
print("Sha256 Hash: ${Hashing.bytes2Hash(hsh)}");
|
|
|
|
|
|
|
|
expect(Hashing.bytes2Hash(hsh),
|
|
|
|
"bea0b72e71bfe7f15a88c25305bf96a9681e34d3aabe0c9a1b7093cb32d8ff05");
|
|
|
|
});
|
2024-05-16 02:59:10 -07:00
|
|
|
}
|