Created
April 7, 2019 13:32
-
-
Save dd01da0465b4542f8f8af4ecedc149ed/aff09a1e6ec6693e4363ee1883d6abcc to your computer and use it in GitHub Desktop.
Nintendo Network password hash function in C#
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public string HashPassword(int Pid, string Password) | |
{ | |
MemoryStream Stream = new MemoryStream(); | |
BinaryWriter Writer = new BinaryWriter(Stream); | |
Writer.Write(Pid); | |
Writer.Write(new byte[] { 0x02, 0x65, 0x43, 0x46 }); // Salt | |
Writer.Write(Encoding.ASCII.GetBytes(Password)); | |
byte[] Hash = Sha256.ComputeHash(Stream.ToArray()); | |
return BitConverter.ToString(Hash).Replace("-", string.Empty); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment