예제 #1
0
 public static String makeKey(String value, String salt) {
   StringBuffer sb = new StringBuffer();
   sb.append(value);
   sb.append('|');
   sb.append(EncryptUtil.makeHashed(value, salt));
   return sb.toString();
 }
예제 #2
0
 public static Boolean verifyKey(String key_value, String salt) {
   StringTokenizer st = new StringTokenizer(key_value, "|");
   if (st.countTokens() != 2) {
     return false;
   }
   String value = st.nextToken();
   String hashed = st.nextToken();
   if (hashed.equals(EncryptUtil.makeHashed(value, salt))) {
     return true;
   }
   return false;
 }