LoginSignup
0
0

More than 1 year has passed since last update.

cscの作法 その224

Last updated at Posted at 2022-07-01

概要

cscの作法、調べてみた。
SHA256CryptoServiceProvider使ってみた。

サンプルコード

using System;
using System.IO;
using System.Security.Cryptography;
using System.Collections.Generic;
using System.Text;

	class test0 {
		static void Main() {
			var result = "";
			var hello = "password";
			Console.WriteLine(hello);
			var encoder = new UTF8Encoding();
			var buffer = encoder.GetBytes(hello);
			using (var csp = new SHA256CryptoServiceProvider())
			{
				var hash = csp.ComputeHash(buffer);
				result = Convert.ToBase64String(hash);
			}
			Console.WriteLine(result);
		}
	}

実行結果

>sha0
password
XohImNooBHFR0OVvjcYpJ3NgPQ1qq73WKhHvch0VQtg=

以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0