using System.Security.Principal;
using System.Security.Cryptography;
public static void Main()
string phrase = "Hello World";
var encoder = new UTF8Encoding();
var sha256Hasher = new SHA256Managed();
var hashedDataBytes = sha256Hasher.ComputeHash(encoder.GetBytes(phrase));
Console.WriteLine(Convert.ToBase64String(hashedDataBytes));
string initStr = "Hello *****";
var si = new StringIter("Hello *****");
string nextHash = Convert.ToBase64String(sha256Hasher.ComputeHash(encoder.GetBytes(si.GetNextString())));
if (nextHash == "pZGm1Av0IEBKARczz7exkNYsZb8LzaMrV7J32a2fFG4=")
Console.WriteLine(si.GetCurrentString());
Console.WriteLine(System.DateTime.Now + " " + si.GetCurrentString());
private string chars = @"123467890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!\""#$%&'()=~|@`{}[]/_,.-^+* ";
private StringBuilder current = null;
public StringIter(string initString)
this.current = new StringBuilder(initString);
public string GetCurrentString()
return current.ToString();
public string GetNextString()
int lastDigit = current.Length - 1;
char lastChar = current[current.Length - 1];
return current.ToString();
private void UpgradeDigit(int digit)
if (this.current.Length < digit)
int targetIndex = current.Length - digit;
char targetChar = current[targetIndex];
if (chars.IndexOf(targetChar) >= chars.Length -1)
current[targetIndex] = chars[0];
else if (this.current.Length == digit)
current.Insert(0, chars[0]);
current[targetIndex] = chars[chars.IndexOf(targetChar) + 1];