Sha is commonly use for an algorithm like in hashing. The AND, OR, and NOT those are the logic gates uses these commonly use for computer language
in AND if there is a 0 the value becomes 0. In boolean expression if there is a false it is already false
Example
001
111
Answer
001
Example
H0 - 01100111010001010010001100000001
H1 - 11101111110011011010101110001001
Answer
01100111010001010010001100000001
In OR if there is a true statement it is already true. If there is 1 it becomes 1
Example
011
111
Answer
111
Example
H2 - 10011000101110101101110011111110
H3 - 00010000001100100101010001110110
Answer
10011000101110101101110011111110
In NOT you are going to reverse the particular value. If this is true the value becomes false.
Example
0
Answer
1
Example
H4 - 11000011110100101110000111110000
Answer
00111100001011010001111000001111
I hope this will help you to enlighten.
Before I create a simple hashing using SHA-256
Random r = new Random();
char[] codes = "abcdefghijklmnopqrstuvwzyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ".ToArray();
string output;
void generateKey(int gkey)
{
output = null;
for (int x = 0; x < codes.Length; x++)
{
output += codes[r.Next(0, codes.Length)];
}
t1bx.Text = output;
}
private void B_generate_Click(object sender, RoutedEventArgs e)
{
generateKey(10);
}
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();
}
}
private void B_hash_Click(object sender, RoutedEventArgs e)
{
txtbx_hash.Text = ComputeSha256Hash(output);
}
I hope this will help you how to make a sha.