HC_common.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /**
  2. * Copyright 2021, 2024 5 Mode
  3. *
  4. * This file is part of Http Console.
  5. *
  6. * Http Console is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * Http Console is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with Http Console. If not, see <https://www.gnu.org/licenses/>.
  18. *
  19. * commons.js
  20. *
  21. * Common constants and functions
  22. *
  23. * @author Daniele Bonini <my25mb@aol.com>
  24. * @copyrights (c) 2021, 2024, the Open Gallery's contributors
  25. */
  26. /**
  27. * Encrypt the given string
  28. *
  29. * @param {string} string - The string to encrypt
  30. * @returns {string} the encrypted string
  31. */
  32. function encryptSha2(string) {
  33. var jsSHAo = new jsSHA("SHA-256", "TEXT", 1);
  34. jsSHAo.update(string);
  35. return jsSHAo.getHash("HEX");
  36. }