Data update
This commit is contained in:
parent
4bb20c9b71
commit
cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions
34
Task/SHA-256/Ada/sha-256.adb
Normal file
34
Task/SHA-256/Ada/sha-256.adb
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
with Ada.Text_IO;
|
||||
|
||||
with CryptAda.Pragmatics;
|
||||
with CryptAda.Digests.Message_Digests.SHA_256;
|
||||
with CryptAda.Digests.Hashes;
|
||||
with CryptAda.Utils.Format;
|
||||
|
||||
procedure RC_SHA_256 is
|
||||
use CryptAda.Pragmatics;
|
||||
use CryptAda.Digests.Message_Digests;
|
||||
use CryptAda.Digests;
|
||||
|
||||
function To_Byte_Array (Item : String) return Byte_Array is
|
||||
Result : Byte_Array (Item'Range);
|
||||
begin
|
||||
for I in Result'Range loop
|
||||
Result (I) := Byte (Character'Pos (Item (I)));
|
||||
end loop;
|
||||
return Result;
|
||||
end To_Byte_Array;
|
||||
|
||||
Text : constant String := "Rosetta code";
|
||||
Bytes : constant Byte_Array := To_Byte_Array (Text);
|
||||
Handle : constant Message_Digest_Handle := SHA_256.Get_Message_Digest_Handle;
|
||||
Pointer : constant Message_Digest_Ptr := Get_Message_Digest_Ptr (Handle);
|
||||
Hash : Hashes.Hash;
|
||||
begin
|
||||
Digest_Start (Pointer);
|
||||
Digest_Update (Pointer, Bytes);
|
||||
Digest_End (Pointer, Hash);
|
||||
|
||||
Ada.Text_IO.Put_Line
|
||||
("""" & Text & """: " & CryptAda.Utils.Format.To_Hex_String (Hashes.Get_Bytes (Hash)));
|
||||
end RC_SHA_256;
|
||||
7
Task/SHA-256/Batch-File/sha-256.bat
Normal file
7
Task/SHA-256/Batch-File/sha-256.bat
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
@echo off
|
||||
setlocal enableextensions
|
||||
pushd "%temp%"
|
||||
<nul set/p"=Rosetta code" > "Rosetta code"
|
||||
certutil -hashfile "Rosetta code" SHA256
|
||||
del "Rosetta code"
|
||||
pause
|
||||
126
Task/SHA-256/EasyLang/sha-256.easy
Normal file
126
Task/SHA-256/EasyLang/sha-256.easy
Normal file
|
|
@ -0,0 +1,126 @@
|
|||
func u32 x .
|
||||
return bitand x 0xFFFFFFFF
|
||||
.
|
||||
func rol x s .
|
||||
left = u32 bitshift x s
|
||||
right = bitshift u32 x -(32 - s)
|
||||
return bitor left right
|
||||
.
|
||||
func rotr x s .
|
||||
return rol x (32 - s)
|
||||
.
|
||||
func sigm1 x .
|
||||
a1 = rotr x 2
|
||||
a2 = rotr x 13
|
||||
r = bitxor a1 a2
|
||||
r = bitxor r rotr x 22
|
||||
return r
|
||||
.
|
||||
func sigm2 x .
|
||||
a1 = rotr x 6
|
||||
a2 = rotr x 11
|
||||
r = bitxor a1 a2
|
||||
r = bitxor r rotr x 25
|
||||
return r
|
||||
.
|
||||
func sigm3 x .
|
||||
a1 = rotr x 7
|
||||
a2 = rotr x 18
|
||||
r = bitxor a1 a2
|
||||
r = bitxor r bitshift x -3
|
||||
return r
|
||||
.
|
||||
func sigm4 x .
|
||||
a1 = rotr x 17
|
||||
a2 = rotr x 19
|
||||
r = bitxor a1 a2
|
||||
r = bitxor r bitshift x -10
|
||||
return r
|
||||
.
|
||||
func be32 b0 b1 b2 b3 .
|
||||
return b0 * 16777216 + b1 * 65536 + b2 * 256 + b3
|
||||
.
|
||||
func$ word2hex w .
|
||||
for k = 0 to 3
|
||||
w = rol w 8
|
||||
h = w mod 256
|
||||
for c in [ h div 16 h mod 16 ]
|
||||
c += 48
|
||||
if c >= 58 : c += 39
|
||||
hex$ &= strchar c
|
||||
.
|
||||
.
|
||||
return hex$
|
||||
.
|
||||
func[] str2bytes s$ .
|
||||
for ch$ in strchars s$ : out[] &= strcode ch$
|
||||
return out[]
|
||||
.
|
||||
proc sha256pad &data[] .
|
||||
n = len data[] * 8
|
||||
data[] &= 0x80
|
||||
while len data[] mod 64 <> 56 : data[] &= 0x00
|
||||
for i = 1 to 8
|
||||
tmp[] &= (n mod 256)
|
||||
n = n div 256
|
||||
.
|
||||
for i = 1 to 8 : data[] &= tmp[9 - i]
|
||||
.
|
||||
K[] = [ 0x428A2F98 0x71374491 0xB5C0FBCF 0xE9B5DBA5 0x3956C25B 0x59F111F1 0x923F82A4 0xAB1C5ED5 0xD807AA98 0x12835B01 0x243185BE 0x550C7DC3 0x72BE5D74 0x80DEB1FE 0x9BDC06A7 0xC19BF174 0xE49B69C1 0xEFBE4786 0x0FC19DC6 0x240CA1CC 0x2DE92C6F 0x4A7484AA 0x5CB0A9DC 0x76F988DA 0x983E5152 0xA831C66D 0xB00327C8 0xBF597FC7 0xC6E00BF3 0xD5A79147 0x06CA6351 0x14292967 0x27B70A85 0x2E1B2138 0x4D2C6DFC 0x53380D13 0x650A7354 0x766A0ABB 0x81C2C92E 0x92722C85 0xA2BFE8A1 0xA81A664B 0xC24B8B70 0xC76C51A3 0xD192E819 0xD6990624 0xF40E3585 0x106AA070 0x19A4C116 0x1E376C08 0x2748774C 0x34B0BCB5 0x391C0CB3 0x4ED8AA4A 0x5B9CCA4F 0x682E6FF3 0x748F82EE 0x78A5636F 0x84C87814 0x8CC70208 0x90BEFFFA 0xA4506CEB 0xBEF9A3F7 0xC67178F2 ]
|
||||
proc sha256block &H0 &H1 &H2 &H3 &H4 &H5 &H6 &H7 blk[] .
|
||||
W[] = [ ] ; len W[] 64
|
||||
for i = 0 to 15
|
||||
b0 = blk[i * 4 + 1] ; b1 = blk[i * 4 + 2]
|
||||
b2 = blk[i * 4 + 3] ; b3 = blk[i * 4 + 4]
|
||||
W[i + 1] = be32 b0 b1 b2 b3
|
||||
.
|
||||
for t = 17 to 64
|
||||
s0 = sigm3 W[t - 15]
|
||||
s1 = sigm4 W[t - 2]
|
||||
W[t] = u32 (W[t - 16] + s0 + W[t - 7] + s1)
|
||||
.
|
||||
a = H0 ; b = H1 ; c = H2 ; d = H3 ; e = H4 ; f = H5 ; g = H6 ; h = H7
|
||||
for t = 1 to 64
|
||||
ch = bitxor (bitand e f) (bitand (bitnot e) g)
|
||||
T1 = u32 (h + sigm2 e + ch + K[t] + W[t])
|
||||
h = bitxor (bitand a b) (bitand a c)
|
||||
maj = bitxor h (bitand b c)
|
||||
T2 = u32 (sigm1 a + maj)
|
||||
h = g
|
||||
g = f
|
||||
f = e
|
||||
e = u32 (d + T1)
|
||||
d = c
|
||||
c = b
|
||||
b = a
|
||||
a = u32 (T1 + T2)
|
||||
.
|
||||
H0 = u32 (H0 + a)
|
||||
H1 = u32 (H1 + b)
|
||||
H2 = u32 (H2 + c)
|
||||
H3 = u32 (H3 + d)
|
||||
H4 = u32 (H4 + e)
|
||||
H5 = u32 (H5 + f)
|
||||
H6 = u32 (H6 + g)
|
||||
H7 = u32 (H7 + h)
|
||||
.
|
||||
func$ sha256 s$ .
|
||||
H0 = 0x6A09E667
|
||||
H1 = 0xBB67AE85
|
||||
H2 = 0x3C6EF372
|
||||
H3 = 0xA54FF53A
|
||||
H4 = 0x510E527F
|
||||
H5 = 0x9B05688C
|
||||
H6 = 0x1F83D9AB
|
||||
H7 = 0x5BE0CD19
|
||||
data[] = str2bytes s$
|
||||
sha256pad data[]
|
||||
blocks = len data[] / 64
|
||||
for b = 0 to blocks - 1
|
||||
blk[] = [ ]
|
||||
for i = 1 to 64 : blk[] &= data[b * 64 + i]
|
||||
sha256block H0 H1 H2 H3 H4 H5 H6 H7 blk[]
|
||||
.
|
||||
return word2hex H0 & word2hex H1 & word2hex H2 & word2hex H3 & word2hex H4 & word2hex H5 & word2hex H6 & word2hex H7
|
||||
.
|
||||
print sha256 "Rosetta code"
|
||||
1
Task/SHA-256/Emacs-Lisp/sha-256.el
Normal file
1
Task/SHA-256/Emacs-Lisp/sha-256.el
Normal file
|
|
@ -0,0 +1 @@
|
|||
(secure-hash 'sha256 "Rosetta code") ;; as string of hex digits
|
||||
96
Task/SHA-256/Fortran/sha-256-1.f
Normal file
96
Task/SHA-256/Fortran/sha-256-1.f
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
module sha256_mod
|
||||
use kernel32
|
||||
use advapi32
|
||||
implicit none
|
||||
integer, parameter :: SHA256LEN = 32
|
||||
contains
|
||||
subroutine sha256hash(name, hash, dwStatus, filesize)
|
||||
implicit none
|
||||
character(*) :: name
|
||||
integer, parameter :: BUFLEN = 32768
|
||||
integer(HANDLE) :: hFile, hProv, hHash
|
||||
integer(DWORD) :: dwStatus, nRead
|
||||
integer(BOOL) :: status
|
||||
integer(BYTE) :: buffer(BUFLEN)
|
||||
integer(BYTE) :: hash(SHA256LEN)
|
||||
integer(UINT64) :: filesize
|
||||
|
||||
dwStatus = 0
|
||||
filesize = 0
|
||||
hFile = CreateFile(trim(name) // char(0), GENERIC_READ, FILE_SHARE_READ, NULL, &
|
||||
OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL)
|
||||
|
||||
if (hFile == INVALID_HANDLE_VALUE) then
|
||||
dwStatus = GetLastError()
|
||||
print *, "CreateFile failed."
|
||||
return
|
||||
end if
|
||||
|
||||
if (CryptAcquireContext(hProv, NULL, MS_ENH_RSA_AES_PROV, PROV_RSA_AES, &
|
||||
CRYPT_VERIFYCONTEXT) == FALSE) then
|
||||
|
||||
dwStatus = GetLastError()
|
||||
print *, "CryptAcquireContext failed.", dwStatus
|
||||
goto 3
|
||||
end if
|
||||
|
||||
if (CryptCreateHash(hProv, CALG_SHA_256, 0_ULONG_PTR, 0_DWORD, hHash) == FALSE) then
|
||||
|
||||
dwStatus = GetLastError()
|
||||
print *, "CryptCreateHash failed."
|
||||
go to 2
|
||||
end if
|
||||
|
||||
do
|
||||
status = ReadFile(hFile, loc(buffer), BUFLEN, nRead, NULL)
|
||||
if (status == FALSE .or. nRead == 0) exit
|
||||
filesize = filesize + nRead
|
||||
if (CryptHashData(hHash, buffer, nRead, 0) == FALSE) then
|
||||
dwStatus = GetLastError()
|
||||
print *, "CryptHashData failed."
|
||||
go to 1
|
||||
end if
|
||||
end do
|
||||
|
||||
if (status == FALSE) then
|
||||
dwStatus = GetLastError()
|
||||
print *, "ReadFile failed."
|
||||
go to 1
|
||||
end if
|
||||
|
||||
nRead = SHA256LEN
|
||||
if (CryptGetHashParam(hHash, HP_HASHVAL, hash, nRead, 0) == FALSE) then
|
||||
dwStatus = GetLastError()
|
||||
print *, "CryptGetHashParam failed."
|
||||
end if
|
||||
|
||||
1 status = CryptDestroyHash(hHash)
|
||||
2 status = CryptReleaseContext(hProv, 0)
|
||||
3 status = CloseHandle(hFile)
|
||||
end subroutine
|
||||
end module
|
||||
|
||||
program sha256
|
||||
use sha256_mod
|
||||
implicit none
|
||||
integer :: n, m, i, j
|
||||
character(:), allocatable :: name
|
||||
integer(DWORD) :: dwStatus
|
||||
integer(BYTE) :: hash(SHA256LEN)
|
||||
integer(UINT64) :: filesize
|
||||
|
||||
n = command_argument_count()
|
||||
do i = 1, n
|
||||
call get_command_argument(i, length=m)
|
||||
allocate(character(m) :: name)
|
||||
call get_command_argument(i, name)
|
||||
call sha256hash(name, hash, dwStatus, filesize)
|
||||
if (dwStatus == 0) then
|
||||
do j = 1, SHA256LEN
|
||||
write(*, "(Z2.2)", advance="NO") hash(j)
|
||||
end do
|
||||
write(*, "(' ',A,' (',G0,' bytes)')") name, filesize
|
||||
end if
|
||||
deallocate(name)
|
||||
end do
|
||||
end program
|
||||
194
Task/SHA-256/Fortran/sha-256-2.f
Normal file
194
Task/SHA-256/Fortran/sha-256-2.f
Normal file
|
|
@ -0,0 +1,194 @@
|
|||
! Version translated to Fortran on 2025-11-02
|
||||
! Based on FIPS PUB 180-4 SHA-256 implementation
|
||||
|
||||
PROGRAM sha256_test
|
||||
IMPLICIT NONE
|
||||
CHARACTER(LEN=*), PARAMETER :: test = "Rosetta code"
|
||||
CHARACTER(LEN=64) :: sha256
|
||||
WRITE(*,*) TRIM(test), " => ", sha256(test)
|
||||
END PROGRAM sha256_test
|
||||
|
||||
FUNCTION sha256(input_message)
|
||||
IMPLICIT NONE
|
||||
CHARACTER(LEN=*), INTENT(IN) :: input_message
|
||||
CHARACTER(LEN=64) :: sha256
|
||||
|
||||
INTEGER, PARAMETER :: wp = 4 ! 32-bit integers
|
||||
INTEGER, PARAMETER :: bits = 32
|
||||
INTEGER(wp), DIMENSION(0:63) :: k, w
|
||||
INTEGER(wp) :: h0, h1, h2, h3, h4, h5, h6, h7
|
||||
INTEGER(wp) :: a, b, c, d, e, f, g, h
|
||||
INTEGER(wp) :: t1, t2
|
||||
CHARACTER(LEN=:), ALLOCATABLE :: msg
|
||||
INTEGER(8) :: bitlen
|
||||
INTEGER :: msglen, padlen, num_blocks, i, j, block_start
|
||||
CHARACTER(LEN=1), DIMENSION(8) :: lenbytes
|
||||
INTEGER(8) :: temp
|
||||
|
||||
! Constants (K)
|
||||
k = [ int(z'428a2f98'), int(z'71374491'), int(z'b5c0fbcf'), int(z'e9b5dba5'), int(z'3956c25b'), int(z'59f111f1'), &
|
||||
int(z'923f82a4'), int(z'ab1c5ed5'), int(z'd807aa98'), int(z'12835b01'), int(z'243185be'), int(z'550c7dc3'), &
|
||||
int(z'72be5d74'), int(z'80deb1fe'), int(z'9bdc06a7'), int(z'c19bf174'), int(z'e49b69c1'), int(z'efbe4786'), &
|
||||
int(z'0fc19dc6'), int(z'240ca1cc'), int(z'2de92c6f'), int(z'4a7484aa'), int(z'5cb0a9dc'), int(z'76f988da'), &
|
||||
int(z'983e5152'), int(z'a831c66d'), int(z'b00327c8'), int(z'bf597fc7'), int(z'c6e00bf3'), int(z'd5a79147'), &
|
||||
int(z'06ca6351'), int(z'14292967'), int(z'27b70a85'), int(z'2e1b2138'), int(z'4d2c6dfc'), int(z'53380d13'), &
|
||||
int(z'650a7354'), int(z'766a0abb'), int(z'81c2c92e'), int(z'92722c85'), int(z'a2bfe8a1'), int(z'a81a664b'), &
|
||||
int(z'c24b8b70'), int(z'c76c51a3'), int(z'd192e819'), int(z'd6990624'), int(z'f40e3585'), int(z'106aa070'), &
|
||||
int(z'19a4c116'), int(z'1e376c08'), int(z'2748774c'), int(z'34b0bcb5'), int(z'391c0cb3'), int(z'4ed8aa4a'), &
|
||||
int(z'5b9cca4f'), int(z'682e6ff3'), int(z'748f82ee'), int(z'78a5636f'), int(z'84c87814'), int(z'8cc70208'), &
|
||||
int(z'90befffa'), int(z'a4506ceb'), int(z'bef9a3f7'), int(z'c67178f2') ]
|
||||
|
||||
! Initial hash values
|
||||
h0 = int(z'6a09e667')
|
||||
h1 = int(z'bb67ae85')
|
||||
h2 = int(z'3c6ef372')
|
||||
h3 = int(z'a54ff53a')
|
||||
h4 = int(z'510e527f')
|
||||
h5 = int(z'9b05688c')
|
||||
h6 = int(z'1f83d9ab')
|
||||
h7 = int(z'5be0cd19')
|
||||
|
||||
! Pre-processing: padding the message
|
||||
bitlen = LEN(input_message) * 8_8
|
||||
msg = input_message // CHAR(128)
|
||||
msglen = LEN(msg)
|
||||
padlen = 64 - MOD(msglen, 64)
|
||||
IF (padlen < 8) padlen = padlen + 64
|
||||
msg = msg // REPEAT(CHAR(0), padlen)
|
||||
msglen = LEN(msg)
|
||||
|
||||
! Append the bit length as big-endian 64-bit integer
|
||||
temp = bitlen
|
||||
DO i = 1, 8
|
||||
lenbytes(i) = CHAR(IAND(temp, 255_8))
|
||||
temp = ISHFT(temp, -8)
|
||||
END DO
|
||||
DO i = 0, 7
|
||||
msg(msglen - 7 + i : msglen - 7 + i) = lenbytes(8 - i)
|
||||
END DO
|
||||
|
||||
! Number of 64-byte blocks
|
||||
num_blocks = msglen / 64
|
||||
|
||||
! Process each block
|
||||
DO j = 0, num_blocks - 1
|
||||
block_start = j * 64 + 1
|
||||
|
||||
! Break block into sixteen 32-bit big-endian words w(0:15)
|
||||
DO i = 0, 15
|
||||
w(i) = IOR( IOR(ISHFT(ICHAR(msg(block_start + i*4 :)), 24), &
|
||||
ISHFT(ICHAR(msg(block_start + i*4 + 1 :)), 16)), &
|
||||
IOR(ISHFT(ICHAR(msg(block_start + i*4 + 2 :)), 8), &
|
||||
ICHAR(msg(block_start + i*4 + 3 :))))
|
||||
END DO
|
||||
|
||||
! Extend to w(16:63)
|
||||
DO i = 16, 63
|
||||
w(i) = sigma3(w(i-2)) + w(i-7) + sigma2(w(i-15)) + w(i-16)
|
||||
END DO
|
||||
|
||||
! Initialize working variables
|
||||
a = h0
|
||||
b = h1
|
||||
c = h2
|
||||
d = h3
|
||||
e = h4
|
||||
f = h5
|
||||
g = h6
|
||||
h = h7
|
||||
|
||||
! Compression
|
||||
DO i = 0, 63
|
||||
t1 = h + sigma1(e) + ch(e, f, g) + k(i) + w(i)
|
||||
t2 = sigma0(a) + maj(a, b, c)
|
||||
h = g
|
||||
g = f
|
||||
f = e
|
||||
e = d + t1
|
||||
d = c
|
||||
c = b
|
||||
b = a
|
||||
a = t1 + t2
|
||||
END DO
|
||||
|
||||
! Add to current hash
|
||||
h0 = h0 + a
|
||||
h1 = h1 + b
|
||||
h2 = h2 + c
|
||||
h3 = h3 + d
|
||||
h4 = h4 + e
|
||||
h5 = h5 + f
|
||||
h6 = h6 + g
|
||||
h7 = h7 + h
|
||||
END DO
|
||||
|
||||
! Produce the final hash as hex string
|
||||
sha256 = to_hex(h0) // to_hex(h1) // to_hex(h2) // to_hex(h3) // &
|
||||
to_hex(h4) // to_hex(h5) // to_hex(h6) // to_hex(h7)
|
||||
CONTAINS
|
||||
|
||||
FUNCTION ch(x, y, z)
|
||||
INTEGER(wp), INTENT(IN) :: x, y, z
|
||||
INTEGER(wp) :: ch
|
||||
ch = IEOR(IAND(x, y), IAND(NOT(x), z))
|
||||
END FUNCTION ch
|
||||
|
||||
FUNCTION maj(x, y, z)
|
||||
INTEGER(wp), INTENT(IN) :: x, y, z
|
||||
INTEGER(wp) :: maj
|
||||
maj = IEOR(IEOR(IAND(x, y), IAND(x, z)), IAND(y, z))
|
||||
END FUNCTION maj
|
||||
|
||||
FUNCTION sigma0(x)
|
||||
INTEGER(wp), INTENT(IN) :: x
|
||||
INTEGER(wp) :: sigma0
|
||||
sigma0 = IEOR(IEOR(rotr(x, 2), rotr(x, 13)), rotr(x, 22))
|
||||
END FUNCTION sigma0
|
||||
|
||||
FUNCTION sigma1(x)
|
||||
INTEGER(wp), INTENT(IN) :: x
|
||||
INTEGER(wp) :: sigma1
|
||||
sigma1 = IEOR(IEOR(rotr(x, 6), rotr(x, 11)), rotr(x, 25))
|
||||
END FUNCTION sigma1
|
||||
|
||||
FUNCTION sigma2(x)
|
||||
INTEGER(wp), INTENT(IN) :: x
|
||||
INTEGER(wp) :: sigma2
|
||||
sigma2 = IEOR(IEOR(rotr(x, 7), rotr(x, 18)), shr(x, 3))
|
||||
END FUNCTION sigma2
|
||||
|
||||
FUNCTION sigma3(x)
|
||||
INTEGER(wp), INTENT(IN) :: x
|
||||
INTEGER(wp) :: sigma3
|
||||
sigma3 = IEOR(IEOR(rotr(x, 17), rotr(x, 19)), shr(x, 10))
|
||||
END FUNCTION sigma3
|
||||
|
||||
FUNCTION rotr(x, n)
|
||||
INTEGER(wp), INTENT(IN) :: x
|
||||
INTEGER, INTENT(IN) :: n
|
||||
INTEGER(wp) :: rotr
|
||||
rotr = ISHFTC(x, -n, bits)
|
||||
END FUNCTION rotr
|
||||
|
||||
FUNCTION shr(x, n)
|
||||
INTEGER(wp), INTENT(IN) :: x
|
||||
INTEGER, INTENT(IN) :: n
|
||||
INTEGER(wp) :: shr
|
||||
shr = ISHFT(x, -n)
|
||||
END FUNCTION shr
|
||||
|
||||
FUNCTION to_hex(val)
|
||||
INTEGER(wp), INTENT(IN) :: val
|
||||
CHARACTER(LEN=8) :: to_hex
|
||||
CHARACTER(LEN=16), PARAMETER :: digits = '0123456789abcdef'
|
||||
INTEGER(8) :: uval, rem
|
||||
INTEGER :: pos
|
||||
uval = IAND(INT(val, 8), int(z'00000000FFFFFFFF',8))
|
||||
DO pos = 8, 1, -1
|
||||
rem = MOD(uval, 16_8)
|
||||
to_hex(pos:pos) = digits(INT(rem)+1:INT(rem)+1)
|
||||
uval = uval / 16
|
||||
END DO
|
||||
END FUNCTION to_hex
|
||||
|
||||
END FUNCTION sha256
|
||||
8
Task/SHA-256/Haxe/sha-256.hx
Normal file
8
Task/SHA-256/Haxe/sha-256.hx
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
import haxe.crypto.Sha256;
|
||||
|
||||
class Main {
|
||||
static function main() {
|
||||
var sha256 = Sha256.encode("Rosetta code");
|
||||
Sys.println(sha256);
|
||||
}
|
||||
}
|
||||
3
Task/SHA-256/Pluto/sha-256.pluto
Normal file
3
Task/SHA-256/Pluto/sha-256.pluto
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
local crypto = require("crypto")
|
||||
|
||||
print(crypto.sha256("Rosetta code"))
|
||||
2
Task/SHA-256/PowerShell/sha-256.ps1
Normal file
2
Task/SHA-256/PowerShell/sha-256.ps1
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
Set-Content -Value "Rosetta code" -Path C:\Colors\blue.txt -NoNewline -Force
|
||||
Get-FileHash -Path C:\Colors\blue.txt -Algorithm SHA256
|
||||
1
Task/SHA-256/Rebol/sha-256.rebol
Normal file
1
Task/SHA-256/Rebol/sha-256.rebol
Normal file
|
|
@ -0,0 +1 @@
|
|||
checksum "Rosetta code" 'sha256
|
||||
Loading…
Add table
Add a link
Reference in a new issue