September 2017 Update

This commit is contained in:
Ingy döt Net 2017-09-23 10:01:46 +02:00
parent bba7bfd280
commit ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions

View file

@ -0,0 +1,14 @@
PRAGMA INCLUDE <openssl/sha.h>
PRAGMA LDFLAGS -lcrypto
OPTION MEMTYPE unsigned char
DECLARE result TYPE unsigned char*
result = SHA256("Rosetta code", 12, 0)
FOR i = 0 TO SHA256_DIGEST_LENGTH-1
PRINT PEEK(result+i) FORMAT "%02x"
NEXT
PRINT

View file

@ -0,0 +1,19 @@
#include <iostream>
#include <cryptopp/filters.h>
#include <cryptopp/hex.h>
#include <cryptopp/sha.h>
int main(int argc, char **argv){
CryptoPP::SHA256 hash;
std::string digest;
std::string message = "Rosetta code";
CryptoPP::StringSource s(message, true,
new CryptoPP::HashFilter(hash,
new CryptoPP::HexEncoder(
new CryptoPP::StringSink(digest))));
std::cout << digest << std::endl;
return 0;
}

View file

@ -87,7 +87,7 @@ program sha256
allocate(character(m) :: name)
call get_command_argument(i, name)
call sha256hash(name, hash, dwStatus, filesize)
if (dwStatus*0 == 0) then
if (dwStatus == 0) then
do j = 1, SHA256LEN
write(*, "(Z2.2)", advance="NO") hash(j)
end do

View file

@ -0,0 +1,2 @@
$var = "Rosetta code";
echo sha2($var, 256);

View file

@ -3,7 +3,7 @@ standard = "764faf5c61ac315f1497f9dfa542713965b785e5cc2f707d6468d7d1124cdfcf"
using SHA
crypt = sha256(clear)
crypt = join(map(hex, sha256("Rosetta code")))
println("Testing Julia's SHA-256:")
if crypt == standard

View 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-256")
val digest = md.digest(bytes)
for (byte in digest) print("%02x".format(byte))
println()
}

View 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

View file

@ -0,0 +1,2 @@
var MsgHash=Import("zklMsgHash");
MsgHash.SHA256("Rosetta code")=="764faf5c61ac315f1497f9dfa542713965b785e5cc2f707d6468d7d1124cdfcf"