Skip to content

Instantly share code, notes, and snippets.

@thexeromin
Created February 4, 2023 07:27
Show Gist options
  • Save thexeromin/e000748346e086b59e5078a29443c01d to your computer and use it in GitHub Desktop.
Save thexeromin/e000748346e086b59e5078a29443c01d to your computer and use it in GitHub Desktop.
import { SHA256 } from "crypto-js";
const createHash = (str1, str2) => {
let arr1 = [str1, str2];
const sortAlphaNum = (a, b) => a.localeCompare(b, "en", { numeric: true });
const arrayOutput = arr1.sort(sortAlphaNum);
const hash = SHA256(arrayOutput.join("")).toString();
return hash;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment