Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add md5sum tool using MappedByteArray from Kapace++'s gci task
- Loading branch information
Showing
1 changed file
with
21 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
.sub main | ||
.param pmc argv | ||
load_bytecode "Digest/MD5.pbc" | ||
.local pmc mba | ||
.local string filename | ||
|
||
set filename, argv[1] | ||
$S0 = "Creating new MappedByteArray, and opening " . filename | ||
say $S0 | ||
mba = new 'MappedByteArray' | ||
mba.'open'(filename) | ||
|
||
say 'getting the data from the Mapped Byte Array...' | ||
$I1 = elements mba | ||
$S0 = mba.'get_string'(0, $I1, 'binary') | ||
|
||
$P1 = _md5sum($S0) | ||
$S0 = _md5_hex($P1) | ||
say $S0 | ||
.end | ||
|