Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Comparing hashing with different encoding and also transferring bytes
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using System.Text; using System.Security.Cryptography; namespace Rextester { public class Program { public static void Main(string[] args) { string key = "072e77e426f92738a72fe23c4d1953b4"; string text = "{super duper long string}"; System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding(); Byte[] keyBytes = encoding.GetBytes(key); Byte[] textBytes = encoding.GetBytes(text); System.Text.ASCIIEncoding encoding2 = new System.Text.ASCIIEncoding(); byte[] ascTextBytes = encoding2.GetBytes(key); byte[] textBytes2 = encoding2.GetBytes(text); Console.WriteLine("Strings"); Console.WriteLine(BitConverter.ToString(keyBytes)); Console.WriteLine(BitConverter.ToString(ascTextBytes)); Console.WriteLine("Hashes"); Byte[] hashBytes; Byte[] hashBytes2; using (HMACSHA1 hash = new HMACSHA1(keyBytes)) hashBytes = hash.ComputeHash(textBytes); Console.WriteLine(BitConverter.ToString(hashBytes)); using (HMACSHA1 hash2 = new HMACSHA1(ascTextBytes)) hashBytes2 = hash2.ComputeHash(textBytes2); Console.WriteLine(BitConverter.ToString(hashBytes2)); Console.WriteLine(Convert.ToBase64String(hashBytes)); Console.WriteLine(Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(BitConverter.ToString(hashBytes)))); } } }
Show compiler warnings
[
+
]
Show input
Compilation time: 0,16 sec, absolute running time: 0,11 sec, cpu time: 0,11 sec, average memory usage: 14 Mb, average nr of threads: 3, absolute service time: 0,32 sec
fork mode
|
history
|
discussion