comparison 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
comparison
equal deleted inserted replaced
1515:78d937870762 1516:70a55f49b98e
1 require "java" 1 require "java"
2 local BinaryLuan = require "java:luan.modules.BinaryLuan" 2 local BinaryLuan = require "java:luan.modules.BinaryLuan"
3 local Base64 = require "java:java.util.Base64" 3 local Base64 = require "java:java.util.Base64"
4 local MessageDigest = require "java:java.security.MessageDigest"
4 5
5 6
6 local Binary = {} 7 local Binary = {}
7 8
8 Binary.base64_decode = Base64.getDecoder().decode 9 Binary.base64_decode = Base64.getDecoder().decode
9 Binary.base64_encode = Base64.getEncoder().encodeToString 10 Binary.base64_encode = Base64.getEncoder().encodeToString
10 Binary.binary = BinaryLuan.binary 11 Binary.binary = BinaryLuan.binary
11 Binary.byte = BinaryLuan.byte_ 12 Binary.byte = BinaryLuan.byte_
12 Binary.to_string = BinaryLuan.to_string 13 Binary.to_string = BinaryLuan.to_string
13 14
15 function Binary.digest_message(algorithm,input)
16 return MessageDigest.getInstance(algorithm).digest(input)
17 end
18
14 return Binary 19 return Binary