SHA256 hash generator

This is a free online SHA256 hash generator, sha256 online encrypt

Enter string to convert to SHA256

How does SHA 256 algorithm work?

SHA-256 generates an almost-unique 256-bit (32-byte) signature for a text. A hash is not 'encryption' – it cannot be decrypted back to the original text (it is a 'one-way' cryptographic function, and is a fixed size for any size of source text).

SHA-256 stands for Secure Hash Algorithm 256-bit and it's used for cryptographic security. Cryptographic hash algorithms produce irreversible and unique hashes. The larger the number of possible hashes, the smaller the chance that two values will create the same hash.

What is sha256 used for?

SHA-256 is used in some of the most popular authentication and encryption protocols, including SSL, TLS, IPsec, SSH, and PGP. In Unix and Linux, SHA-256 is used for secure password hashing. Cryptocurrencies such as Bitcoin use SHA-256 for verifying transactions

Can sha256 be decrypted?

SHA-256 is not encryption, it's hashing. You can't decrypt it, that's the whole point with it. You use it by hashing other data and comparing the hash codes to determine if the data is identical to the original.

SHA256 in programming languages

Will the SHA256 cryptographic hash function output be same in all programming languages?
Yes, similar to Md5, sha256 generates the same hash code for all programming languages.


SHA256 in C#

C# how to convert string to SHA256 hash?
SHA256 Class in Microsoft documentation

using System;
using System.Text;
using System.Security.Cryptography;

namespace HashConsoleDemoApp {
  class Program {
    static void Main(string[] args) {
      string plainData = "sita.app";
      Console.WriteLine("Raw data: {0}", plainData);
      string hashedData = ComputeSha256Hash(plainData);
      Console.WriteLine("Hash {0}", hashedData);
      Console.ReadLine();
    }

    static string ComputeSha256Hash(string rawData) {
      // Create a SHA256
      using(SHA256 sha256Hash = SHA256.Create()) {
        // ComputeHash - returns byte array
        byte[] bytes = sha256Hash.ComputeHash(Encoding.UTF8.GetBytes(rawData));
        // Convert byte array to a string
        StringBuilder builder = new StringBuilder();
        for (int i = 0; i < bytes.Length; i++) {
          builder.Append(bytes[i].ToString("x2"));
        }
        return builder.ToString();
      }
    }
  }
}

SHA256 in PHP

PHP convert string to SHA256 hash.
hash function in Php.net

function CreateSHA256HashWithPHP($input) {
  return hash('sha256', $input, false);
}

SHA256 in Dart

Dart or Flutter convert string to SHA256 hash.
SHA256 Class in pub.dev

// import the packages
import 'package:crypto/crypto.dart';
import 'dart:convert'; // for the utf8.encode method

// then hash the string
var bytes = utf8.encode("sita.app"); // data being hashed
var digest = sha256.convert(bytes);
print("Digest as hex string: $digest");
//output: Digest as hex string: 2d57ac7a93a13ae36c1b8dde1e466a735cf5f408d7ef71b9bb5c728e21158fbd

SHA256 in JAVA

JAVA convert string to SHA256 hash.

import java.math.BigInteger;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

class Sha256InJavaBySita {
  public static byte[] getSHA(String input) throws NoSuchAlgorithmException {
    MessageDigest md = MessageDigest.getInstance("SHA-256");
    return md.digest(input.getBytes(StandardCharsets.UTF_8));
  }
  public static String toHexString(byte[] hash) {
    BigInteger number = new BigInteger(1, hash);
    StringBuilder hexString = new StringBuilder(number.toString(16));
    while (hexString.length() < 32) {
      hexString.insert(0, '0');
    }
    return hexString.toString();
  }
  public static void main(String args[]) {
    try {
      System.out.println("HashCode Generated by SHA-256 for:");
      String s1 = "sita.app";
      System.out.println("\n" + s1 + " : " + toHexString(getSHA(s1)));
    }
    catch(NoSuchAlgorithmException e) {
      System.out.println("Exception thrown for incorrect algorithm: " + e);
    }
  }
}

SHA256 in Python

Python convert string to SHA256 hash.
Secure hashes and message digests

#Python 2.x
import hashlib
print hashlib.sha256("sita.app").hexdigest()

#Python 3.x
import hashlib
print(hashlib.sha256("sita.app".encode('utf-8')).hexdigest())

SHA256 in T-SQL

T-SQL convert string to SHA256 hash.
Use HashBytes

CREATE TABLE dbo.Test1 (c1 NVARCHAR(32));
INSERT dbo.Test1 VALUES ('This is a test.');
INSERT dbo.Test1 VALUES ('This is test 2.');
SELECT HASHBYTES('SHA2_256', c1) FROM dbo.Test1;

SHA256 in Nodejs

Nodejs convert string to SHA256.
Nodejs Crypto

const crypto = require('crypto')
let myString='sita.app';
//base64
let hashBase64 = crypto.createHash('sha256').update(myString).digest('base64');
//hex
let hashHex = crypto.createHash('sha256').update(myString).digest('hex');