HTML code scrip for SHA-1 generator

Created on 3 July, 2024 • 111 views • 1 minutes read

HTML code scrip for SHA-1 generator

<!DOCTYPE html>

<html lang="en">

<head>

  <meta charset="UTF-8">

  <meta name="viewport" content="width=device-width, initial-scale=1.0">

  <title>SHA-1 Generator</title>

</head>

<body>

  <h1>SHA-1 Generator</h1>

  <p>Enter your text below to generate its SHA-1 hash:</p>

  <form id="sha1Form">

    <textarea id="textInput" rows="5" cols="50"></textarea>

    <br>

    <button type="button" onclick="generateSHA1()">Generate Hash</button>

    <br>

    <span id="hashOutput"></span>

  </form>

  <script>

    function generateSHA1() {

      const text = document.getElementById("textInput").value;

      const hash = CryptoJS.SHA1(text).toString(); // Using CryptoJS library

      document.getElementById("hashOutput").textContent = "SHA-1 Hash: " + hash;

    }

  </script>

</body>

</html>