Skip to content

Commit 67dfe18

Browse files
committed
FIX: enable ripemd160 checksum
resolves: Oldes/Rebol-issues#2516
1 parent 24faca9 commit 67dfe18

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

src/core/n-strings.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ static struct digest {
203203
data = VAL_BIN_DATA(arg);
204204
}
205205

206-
if (sym > SYM_CRC32 && sym <= SYM_SHA512) {
206+
if (sym > SYM_CRC32 && sym <= SYM_RIPEMD160) {
207207
// O: could be optimized using index computed from `sym`
208208
// find matching digest:
209209
for (i = 0; i < sizeof(digests) / sizeof(digests[0]); i++) {

src/tests/units/checksum-test.r3

+21-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,27 @@ D2079D59D6984814DAC71CDEB38097DB52F77810391FD7B6F92FFBD64EA93DF8
172172
--assert port? update port
173173
--assert sum1 = port/data
174174
close port
175-
175+
if find system/catalog/checksums 'ripemd160 [
176+
;@@ https://github.com/Oldes/Rebol-issues/issues/2516
177+
--test-- "checksum-port-ripemd160"
178+
port: open checksum:ripemd160
179+
sum1: checksum bin 'ripemd160
180+
sum2: checksum join bin bin 'ripemd160
181+
--assert #{595FEC4966B173C6CD00ECCAF1A007F3C6C5B938} = sum1
182+
--assert port? port
183+
--assert open? port
184+
--assert 'ripemd160 = port/spec/method
185+
--assert port? write port bin
186+
--assert sum1 = read port
187+
--assert port? write port bin
188+
--assert sum2 = read port
189+
--assert sum2 = read port
190+
--assert not open? close port
191+
--assert port? write open port bin
192+
--assert port? update port
193+
--assert sum1 = port/data
194+
close port
195+
]
176196
--test-- "checksum-write-refinements"
177197
port: open checksum://
178198
write/part port bin 1

0 commit comments

Comments
 (0)