SHA1 Encrypt/Decrypt Learn How to implement using different languages

 Learn about the sha1 Algorithm

  1. Known as Secure Hash Algorithm 1 (SHA1)
  2. Belongs to the SHA family of hash functions.
  3. It uses the SHA-1 hash algorithm and gets a 160-bit hash value.
  4. 160-bit (20-byte) in the SHA1 algorithm specifies the bit length of the hash output.
  5. Ones encrypted can't be decrypted. We use a database that fetches the matched original value to the hashed value.
Try this SHA1 Converter at BMR ONLINE TOOLS
 
You can decrypt using the BMR ONLINE TOOLS from our large database to be able to decrypt your encrypted data

Implementing Using js

<!DOCTYPE html>
<html>
<head>
<title>SHA-1 Encryption</title>
<script src="https://cdn.jsdelivr.net/npm/crypto-js@4.2.0/index.min.js"></script>
</head>
<body>
<h2>SHA-1 Encryption</h2>
<label for="inputText">Enter Text:</label>
<textarea id="inputText" rows="4" cols="50" placeholder="Enter text"></textarea>
<br>
<button onclick="encryptText()">Encrypt</button>
<br>
<label for="outputText">Result:</label>
<textarea id="outputText" rows="4" cols="50" readonly></textarea>
<script>
function encryptText() {
var inputText = document.getElementById('inputText').value;
var encryptedText = CryptoJS.SHA1(inputText).toString();
document.getElementById('outputText').value = encryptedText;
}
</script>
</body>
</html>

Implementing Using jQuery

<!DOCTYPE html>
<html>
<head>
<title>SHA-1 Encryption</title>
<script src="https://code.jquery.com/jquery-3.6.4.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/crypto-js@4.2.0/crypto-js.min.js"></script>
</head>
<body>
<h2>SHA-1 Encryption</h2>
<label for="inputText">Enter Text:</label>
<textarea id="inputText" rows="4" cols="50" placeholder="Enter text"></textarea>
<br>
<button onclick="encryptText()">Encrypt</button>
<br>
<label for="outputText">Result:</label>
<textarea id="outputText" rows="4" cols="50" readonly></textarea>
<script>
function encryptText() {
var inputText = $('#inputText').val();
var encryptedText = CryptoJS.SHA1(inputText).toString();
$('#outputText').val(encryptedText);
}
</script>
</body>
</html>

Implementing Using PHP

<!DOCTYPE html>
<html>
<head>
<title>SHA-1 Hash Calculator</title>
</head>
<body>
<h2>SHA-1 Hash Calculator</h2>
<form action="" method="post">
<input type="text" name="inputText" placeholder="Enter a value">
<button type="submit" name="calculate">Calculate SHA-1 Hash</button>
</form>
<p>
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["calculate"])) {
$inputValue = $_POST["inputText"];
$sha1Hash = sha1($inputValue);
echo "SHA-1 hash: " . $sha1Hash;
}
?>
</p>
</body>
</html>

Implementing Using Python

import hashlib
def sha1_encrypt(text):
hashed = hashlib.sha1(text.encode()).hexdigest()
return hashed
original_text = "Hello, this is a sample text for SHA-1 encryption."
encrypted_text = sha1_encrypt(original_text)
print("Original Text:", original_text)
print("SHA-1 Encrypted Text:", encrypted_text)

We have many tools, encrypters, encoders, minifies, image, and document tools available for free at BMR ONLINE TOOLS 


Post a Comment

Previous Post Next Post