annotate src/luan/modules/Binary.luan @ 1516:70a55f49b98e

digest_message
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 08 Jun 2020 21:54:31 -0600
parents 60f6741f000a
children
rev   line source
fschmidt@1353 1 require "java"
fschmidt@321 2 local BinaryLuan = require "java:luan.modules.BinaryLuan"
fschmidt@1470 3 local Base64 = require "java:java.util.Base64"
fschmidt@1516 4 local MessageDigest = require "java:java.security.MessageDigest"
fschmidt@302 5
fschmidt@567 6
fschmidt@1088 7 local Binary = {}
fschmidt@503 8
fschmidt@1470 9 Binary.base64_decode = Base64.getDecoder().decode
fschmidt@1472 10 Binary.base64_encode = Base64.getEncoder().encodeToString
fschmidt@1088 11 Binary.binary = BinaryLuan.binary
fschmidt@1088 12 Binary.byte = BinaryLuan.byte_
fschmidt@1088 13 Binary.to_string = BinaryLuan.to_string
fschmidt@503 14
fschmidt@1516 15 function Binary.digest_message(algorithm,input)
fschmidt@1516 16 return MessageDigest.getInstance(algorithm).digest(input)
fschmidt@1516 17 end
fschmidt@1516 18
fschmidt@1088 19 return Binary