File tree 2 files changed +8
-1
lines changed
2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -171,7 +171,7 @@ static struct digest {
171
171
/*
172
172
// checksum: native [
173
173
// {Computes a checksum, CRC, hash, or HMAC.}
174
- // data [binary! string! file!] {If string, it will be UTF8 encoded}
174
+ // data [binary! string! file!] {If string, it will be UTF8 encoded. File is dispatched to file-checksum function. }
175
175
// method [word!] {One of `system/catalog/checksums` and HASH}
176
176
// /with {Extra value for HMAC key or hash table size; not compatible with TCP/CRC24/CRC32/ADLER32 methods.}
177
177
// spec [any-string! binary! integer!] {String or binary for MD5/SHA* HMAC key, integer for hash table size.}
@@ -208,6 +208,9 @@ static struct digest {
208
208
// Dispatch file to file-checksum function...
209
209
REBVAL * func = Find_Word_Value (Lib_Context , SYM_FILE_CHECKSUM );
210
210
if (func && IS_FUNCTION (func ) && sym > SYM_CRC32 && sym <= SYM_RIPEMD160 ) {
211
+ if (D_REF (ARG_CHECKSUM_WITH ) || D_REF (ARG_CHECKSUM_PART ))
212
+ Trap0 (RE_BAD_REFINES );
213
+
211
214
// Build block to evaluate: [file-checksum data method]
212
215
// Where method must be converted to lit-word first...
213
216
VAL_TYPE (method ) = REB_LIT_WORD ;
Original file line number Diff line number Diff line change @@ -273,6 +273,10 @@ AF45D2E376484031617F78D2B58A6B1B9C7EF464F5A01B47E42EC3736322445E
273
273
--assert (checksum %units/files/pdf-maker-doc.pdf 'sha1) == #{ A598B252C045ABF94EE5F034798B384056C57086 }
274
274
--assert (checksum %units/files/pdf-maker-doc.pdf 'sha256) == #{ FA24645FE45C06DEB31DEC0B4478718A3ABE3F8C923A3B720B5564DAA2C9FC0F }
275
275
276
+ --test-- "checksum file! with refines"
277
+ ;; refines are not supported
278
+ --assert all [error? e: try [checksum /part %units/files/pdf-maker-doc.pdf 'md5 1 ] e/id = 'bad-refines]
279
+ --assert all [error? e: try [checksum /with %units/files/pdf-maker-doc.pdf 'md5 1 ] e/id = 'bad-refines]
276
280
===end-group===
277
281
278
282
You can’t perform that action at this time.
0 commit comments