fixes #14003 (#14006) [backport:1.2]

Co-authored-by: cooldome <ariabushenko@bk.ru>
This commit is contained in:
cooldome 2020-04-17 12:23:04 +01:00 • committed by GitHub
commit f10689d3d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 6 deletions

View file

@ -48,3 +48,20 @@ proc `=destroy`(x: var AObj) =
echo "closed"
var x = B(io: newStringStream("thestream"))
#------------------------------------------------------------------------------
# issue #14003
proc cryptCTR*(nonce: var openArray[char]) =
nonce[1] = 'A'
proc main() =
var nonce1 = "0123456701234567"
cryptCTR(nonce1)
doAssert(nonce1 == "0A23456701234567")
var nonce2 = "01234567"
cryptCTR(nonce2.toOpenArray(0, nonce2.len-1))
doAssert(nonce2 == "0A234567")
main()