September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
2
Task/SHA-1/Astro/sha-1.astro
Normal file
2
Task/SHA-1/Astro/sha-1.astro
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
import crypto
|
||||
let hash = sha1 bytes('Ars longa, vita brevis', encoding:'ascii')
|
||||
|
|
@ -85,7 +85,7 @@ program sha1
|
|||
allocate(character(m) :: name)
|
||||
call get_command_argument(i, name)
|
||||
call sha1hash(name, hash, dwStatus, filesize)
|
||||
if (dwStatus*0 == 0) then
|
||||
if (dwStatus == 0) then
|
||||
do j = 1, SHA1LEN
|
||||
write(*, "(Z2.2)", advance="NO") hash(j)
|
||||
end do
|
||||
|
|
|
|||
2
Task/SHA-1/Halon/sha-1.halon
Normal file
2
Task/SHA-1/Halon/sha-1.halon
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
$var = "Rosetta Code";
|
||||
echo sha1($var);
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
words2hex=: '0123456789abcdef' {~ (8#16)&#:
|
||||
|
||||
words2hex sha1 text2bits 'Rosetta Code'
|
||||
48c98f7e
|
||||
5a6e736d
|
||||
790ab740
|
||||
dfc3f51a
|
||||
61abe2b5
|
||||
12
Task/SHA-1/Kotlin/sha-1.kotlin
Normal file
12
Task/SHA-1/Kotlin/sha-1.kotlin
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
// version 1.0.6
|
||||
|
||||
import java.security.MessageDigest
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val text = "Rosetta Code"
|
||||
val bytes = text.toByteArray()
|
||||
val md = MessageDigest.getInstance("SHA-1")
|
||||
val digest = md.digest(bytes)
|
||||
for (byte in digest) print("%02x".format(byte))
|
||||
println()
|
||||
}
|
||||
|
|
@ -16,7 +16,7 @@ sub sha1-pad(Blob $msg)
|
|||
flat @padded.map({ :256[$^a,$^b,$^c,$^d] }), (bits +> 32)mod2³², (bits)mod2³²;
|
||||
}
|
||||
|
||||
sub sha1-block(@H is rw, @M is copy)
|
||||
sub sha1-block(@H, @M is copy)
|
||||
{
|
||||
@M.push: S(1, [+^] @M[$_ «-« <3 8 14 16>] ) for 16 .. 79;
|
||||
|
||||
|
|
|
|||
15
Task/SHA-1/Zkl/sha-1.zkl
Normal file
15
Task/SHA-1/Zkl/sha-1.zkl
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
$ zkl // run the REPL
|
||||
zkl: var MsgHash=Import("zklMsgHash")
|
||||
MsgHash
|
||||
zkl: MsgHash.SHA1("Rosetta Code")
|
||||
48c98f7e5a6e736d790ab740dfc3f51a61abe2b5
|
||||
|
||||
zkl: var hash=MsgHash.SHA1("Rosetta Code",1,False) // hash once, return hash as bytes
|
||||
Data(20)
|
||||
zkl: hash.bytes()
|
||||
L(72,201,143,126,90,110,115,109,121,10,183,64,223,195,245,26,97,171,226,181)
|
||||
zkl: hash.bytes().apply("toString",16).concat()
|
||||
48c98f7e5a6e736d79ab740dfc3f51a61abe2b5
|
||||
|
||||
zkl: MsgHash.SHA1("a"*1000,1000); // hash 1000 a's 1000 times
|
||||
34aa973cd4c4daa4f61eeb2bdbad27316534016f
|
||||
Loading…
Add table
Add a link
Reference in a new issue