private void button6_Click(object sender, EventArgs e) { hasher h = new hasher(); string output = h.sha256ascii(textBox1.Text); //sha256ascii sha = new sha256ascii(); //string output = sha.encode(textBox1.Text); textBox2.Text = output; }
public void Sha256AsciiTest() { /** * PHP: php -r "echo hash('sha256', 'A quick brown fox jumps over the lazy dog.');" * SQL: SELECT SHA2('A quick brown fox jumps over the lazy dog.', 256); * * ffca2587cfd4846e4cb975b503c9eb940f94566aa394e8bd571458b9da5097d5 */ hasher h = new hasher(); string hash = h.sha256ascii("A quick brown fox jumps over the lazy dog."); string expect = "ffca2587cfd4846e4cb975b503c9eb940f94566aa394e8bd571458b9da5097d5"; Assert.AreEqual(expect, hash); }