YAPC::EU 2018 Glasgow Update!

This commit is contained in:
Ingy döt Net 2018-08-17 15:15:24 +01:00
parent 22f33d4004
commit 4e2d22a71d
1170 changed files with 15042 additions and 3047 deletions

View file

@ -0,0 +1,3 @@
USING: checksums checksums.sha io math.parser ;
"Rosetta code" sha-256 checksum-bytes bytes>hex-string print

View file

@ -1 +1 @@
IntegerString[Hash["Rosetta code", "SHA256"], 16]
Hash["Rosetta code","SHA256","HexString"]

View file

@ -1,16 +1,11 @@
constant lib = open_dll("SHA.DLL")
constant SHA_HashBlock = define_c_proc(lib,"SHA_HashBlock",{C_PTR,C_PTR,C_INT})
include builtins\sha256.e
function sha256(string s)
atom mem = allocate(32)
sequence res
c_proc(SHA_HashBlock,{s,mem,length(s)})
res = peek4u({mem,8})
free(mem)
for i=1 to length(res) do
res[i] = sprintf("%08x",res[i])
function asHex(string s)
string res = ""
for i=1 to length(s) do
res &= sprintf("%02X",s[i])
end for
return join(res)
return res
end function
?sha256("Rosetta code")
?asHex(sha256("Rosetta code"))

View file

@ -122,5 +122,4 @@ atom h0 = 0x6a09e667,
return join(res)
end function
string res = sha256("Rosetta code")
?res
?sha256("Rosetta code")

View file

@ -1,7 +1,4 @@
# Project: SHA-256
# Date : 2018/06/09
# Author: Gal Zsolt [~ CalmoSoft ~]
# Email : <calmosoft@gmail.com>
load "stdlib.ring"
str = "Rosetta code"