【发布时间】:2018-10-11 11:55:55
【问题描述】:
我有以下代码来获取 String 的哈希值:
package encryption;
import java.security.MessageDigest;
public class MessageDigestExample {
public static void main(String[] args)throws Exception{
String input = "This is a message";
MessageDigest hash = MessageDigest.getInstance("SHA1");
System.out.println("input : " + input);
hash.update(Utils.toByteArray(input));
System.out.println("digest : " + Utils.toHex(hash.digest()));
} }
我现在遇到了这个异常:
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
Utils cannot be resolved
Utils cannot be resolved
我添加了apache-storm-1.2.2 lib,但不起作用,
请帮忙!
【问题讨论】:
-
仅作记录,因为新用户有时会忘记这一点:请考虑在某个时候接受答案。