-3
我試圖在Ruby中重新創建以下C#代碼行。我對Digest和C#不熟悉,這就是爲什麼我需要這方面的幫助。試圖將C#SHA1摘要代碼轉換爲Ruby
byte[] data = System.Text.Encoding.ASCII.GetBytes(message);
System.Security.Cryptography.SHA1 sha1 = new System.Security.Cryptography.SHA1CryptoServiceProvider();
byte[] result = sha1.ComputeHash(data);
System.Text.StringBuilder sb = new System.Text.StringBuilder();
for(int i=0; i<result.Length; i++) {
sb.Append(result[i].ToString("X2"));
}
堆棧溢出不是一個代碼翻譯服務。你到目前爲止嘗試過什麼,有什麼問題? –