Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
3
Task/SHA-256/Nim/sha-256-1.nim
Normal file
3
Task/SHA-256/Nim/sha-256-1.nim
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
import nimcrypto
|
||||
|
||||
echo sha256.digest("Rosetta code")
|
||||
13
Task/SHA-256/Nim/sha-256-2.nim
Normal file
13
Task/SHA-256/Nim/sha-256-2.nim
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import strutils
|
||||
|
||||
const SHA256Len = 32
|
||||
|
||||
proc SHA256(d: cstring, n: culong, md: cstring = nil): cstring {.cdecl, dynlib: "libssl.so", importc.}
|
||||
|
||||
proc SHA256(s: string): string =
|
||||
result = ""
|
||||
let s = SHA256(s.cstring, s.len.culong)
|
||||
for i in 0 ..< SHA256Len:
|
||||
result.add s[i].BiggestInt.toHex(2).toLower
|
||||
|
||||
echo SHA256("Rosetta code")
|
||||
Loading…
Add table
Add a link
Reference in a new issue