?appId "http://localhost:52701"
?Utils.ByteArrayToBase64String(U2F.Crypto.Hash(appId)) "ENIbQIWZ9ZHrY48rknvb_PjHS6RGN-wkcKM_n0gjCHw"
The results of Crypto.Hash are different between Java and .NET code. Here is the .NET code.
private readonly SHA256Managed _sha256Managed = new SHA256Managed();
public byte[] Hash(byte[] bytes) { try { return _sha256Managed.ComputeHash(bytes); } catch (Exception e) { throw new UnsupportedOperationException("Error when computing SHA-256", e); } }
public byte[] Hash(string str) { byte[] bytes = new byte[str.Length*sizeof (char)]; Buffer.BlockCopy(str.ToCharArray(), 0, bytes, 0, bytes.Length);
return Hash(bytes); }
|