Files
playlet-piped/playlet-lib/src/source/utils/Crypto.bs
T
Brahim Hadriche 0d79c4975e Feature/cherrypick ws (#52)
* int to hex

* Websocket frame size

* Hash methods refactor

* Uri components fix
2023-02-27 20:10:21 -05:00

21 lines
549 B
Plaintext

function GetSha256(input as string) as string
return GetEvpDigest(input, "sha256")
end function
function GetSha1(input as string) as string
return GetEvpDigest(input, "sha1")
end function
function GetMd5(input as string) as string
return GetEvpDigest(input, "md5")
end function
function GetEvpDigest(input as string, method as string) as string
buffer = CreateObject("roByteArray")
buffer.FromAsciiString(input)
digest = CreateObject("roEVPDigest")
digest.Setup(method)
return digest.Process(buffer)
end function