Skip to content

Commit eaf4ab8

Browse files
committed
fix CI again
1 parent ee22492 commit eaf4ab8

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
- `macros.parseExpr` and `macros.parseStmt` now accept an optional
2323
filename argument for more informative errors.
2424
- Module `colors` expanded with missing colors from the CSS color standard.
25+
- `md5` now works at compile time and in JavaScript.
2526

2627
## `std/smtp`
2728

lib/pure/md5.nim

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
## Module for computing [MD5 checksums](https://en.wikipedia.org/wiki/MD5).
1111
##
12-
## **Note:** The procs in this module can be used at compile time.
12+
## This module also works at compile time and in JavaScript.
1313
##
1414
## See also
1515
## ========
@@ -297,9 +297,10 @@ proc writeBuffer(c: var MD5Context, index: int,
297297
memOrNot:
298298
copyMem(addr(c.buffer[index]), unsafeAddr(input[inputIndex]), len)
299299
do:
300-
{.noSideEffect.}:
301-
# `[]=` can sometimes track RangeDefect, even though it cannot be raised here
302-
c.buffer[index .. index + len - 1] = input.slice(inputIndex, inputIndex + len - 1)
300+
# cannot use system.`[]=` for arrays and openarrays as
301+
# it can raise RangeDefect which gets tracked
302+
for i in 0..<len:
303+
c.buffer[index + i] = input[inputIndex + i]
303304

304305
proc md5Update*(c: var MD5Context, input: openArray[uint8]) =
305306
## Updates the `MD5Context` with the `input` data.

0 commit comments

Comments
 (0)