using System.Security.Cryptography;
using System.Text.RegularExpressions;
public static void Main()
Console.WriteLine(GenerateFakeIsbnNew(bookId));
Console.WriteLine(GenerateFakeIsbnReverse(bookId));
public static string GenerateFakeIsbnReverse(string bookId)
using (SHA256 sha256 = SHA256.Create())
byte[] idBytes = Encoding.UTF8.GetBytes(bookId);
byte[] hashBytes = sha256.ComputeHash(idBytes);
return "F" + string.Join("", hashBytes.Reverse().Take(8).Reverse().Select(b => b.ToString("X2")));
public static string GenerateFakeIsbnNew(string bookId)
using (SHA256 sha256 = SHA256.Create())
byte[] idBytes = Encoding.UTF8.GetBytes(bookId);
byte[] hashBytes = sha256.ComputeHash(idBytes);
return "F" + string.Join("", hashBytes.TakeLast(8).Select(b => b.ToString("X2")));