- /**
- * Convenience Function: Hash from String to String Hex representation
- *
- * @param input
- * @return
- * @throws NoSuchAlgorithmException
- */
- public static String hashSHA256asStringHex(String input, int salt) throws NoSuchAlgorithmException {
- byte[] in = input.getBytes();
- ByteBuffer bb = ByteBuffer.allocate(Integer.SIZE + in.length);
- bb.putInt(salt);
- bb.put(input.getBytes());
- return toHex(Hash.hashSHA256(bb.array()));
- }
-
- /**
- * Compare two byte arrays for equivalency
- * @param ba1
- * @param ba2
- * @return
- */
- public static boolean isEqual(byte ba1[], byte ba2[]) {
- if(ba1.length!=ba2.length)return false;
- for(int i = 0;i<ba1.length; ++i) {
- if(ba1[i]!=ba2[i])return false;
- }
- return true;
- }
+ /**
+ * Convenience Function: Hash from String to String Hex representation
+ *
+ * @param input
+ * @return
+ * @throws NoSuchAlgorithmException
+ */
+ public static String hashSHA256asStringHex(String input, int salt) throws NoSuchAlgorithmException {
+ byte[] in = input.getBytes();
+ ByteBuffer bb = ByteBuffer.allocate(Integer.SIZE + in.length);
+ bb.putInt(salt);
+ bb.put(input.getBytes());
+ return toHex(Hash.hashSHA256(bb.array()));
+ }
+
+ /**
+ * Compare two byte arrays for equivalency
+ * @param ba1
+ * @param ba2
+ * @return
+ */
+ public static boolean isEqual(byte ba1[], byte ba2[]) {
+ if (ba1.length!=ba2.length)return false;
+ for (int i = 0;i<ba1.length; ++i) {
+ if (ba1[i]!=ba2[i])return false;
+ }
+ return true;
+ }