Mercurial Hosting > luan
comparison src/luan/modules/StringLuan.java @ 1649:f7e2df85fc0a
add String.digest_message
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 29 Mar 2022 16:07:01 -0600 |
parents | 8fbcc4747091 |
children | ea56e3b04c03 |
comparison
equal
deleted
inserted
replaced
1648:224af797b1f9 | 1649:f7e2df85fc0a |
---|---|
1 package luan.modules; | 1 package luan.modules; |
2 | 2 |
3 import java.security.NoSuchAlgorithmException; | |
3 import java.util.Arrays; | 4 import java.util.Arrays; |
4 import java.util.regex.Pattern; | 5 import java.util.regex.Pattern; |
5 import java.util.regex.Matcher; | 6 import java.util.regex.Matcher; |
6 import luan.Luan; | 7 import luan.Luan; |
7 import luan.LuanTable; | 8 import luan.LuanTable; |
234 Utils.checkNotNull(s); | 235 Utils.checkNotNull(s); |
235 int n = limit==null ? -1 : limit; | 236 int n = limit==null ? -1 : limit; |
236 return s.split(pattern,n); | 237 return s.split(pattern,n); |
237 } | 238 } |
238 | 239 |
240 public static String digest_message(String algorithm,String input) throws LuanException, NoSuchAlgorithmException { | |
241 Utils.checkNotNull(algorithm,1); | |
242 Utils.checkNotNull(input,2); | |
243 return BinaryLuan.to_hex( BinaryLuan.digest_message( algorithm, input.getBytes() ) ); | |
244 } | |
245 | |
239 } | 246 } |