简体   繁体   中英

Converting Plaintext from a text box to SHA1 Then Sha1 to base 64 C#

好吧,我想从纯文本框中生成一个sha1哈希,然后将哈希转换为base64以存储在mysql数据库中,我该怎么做?

        string s = "abc";
        byte[] data = Encoding.Unicode.GetBytes(s);
        SHA1 algorithm = SHA1.Create();
        byte[] hash = algorithm.ComputeHash(data);
        string base64 = Convert.ToBase64String(hash);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM