Skip to content

Commit

Permalink
FIX: enable ripemd160 checksum
Browse files Browse the repository at this point in the history
  • Loading branch information
Oldes committed Aug 18, 2022
1 parent 24faca9 commit 67dfe18
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/core/n-strings.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ static struct digest {
data = VAL_BIN_DATA(arg);
}

if (sym > SYM_CRC32 && sym <= SYM_SHA512) {
if (sym > SYM_CRC32 && sym <= SYM_RIPEMD160) {
// O: could be optimized using index computed from `sym`
// find matching digest:
for (i = 0; i < sizeof(digests) / sizeof(digests[0]); i++) {
Expand Down
22 changes: 21 additions & 1 deletion src/tests/units/checksum-test.r3
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,27 @@ D2079D59D6984814DAC71CDEB38097DB52F77810391FD7B6F92FFBD64EA93DF8
--assert port? update port
--assert sum1 = port/data
close port

if find system/catalog/checksums 'ripemd160 [
;@@ https://github.com/Oldes/Rebol-issues/issues/2516
--test-- "checksum-port-ripemd160"
port: open checksum:ripemd160
sum1: checksum bin 'ripemd160
sum2: checksum join bin bin 'ripemd160
--assert #{595FEC4966B173C6CD00ECCAF1A007F3C6C5B938} = sum1
--assert port? port
--assert open? port
--assert 'ripemd160 = port/spec/method
--assert port? write port bin
--assert sum1 = read port
--assert port? write port bin
--assert sum2 = read port
--assert sum2 = read port
--assert not open? close port
--assert port? write open port bin
--assert port? update port
--assert sum1 = port/data
close port
]
--test-- "checksum-write-refinements"
port: open checksum://
write/part port bin 1
Expand Down

0 comments on commit 67dfe18

Please sign in to comment.