CSharp examples for System.Security.Cryptography:SHA1
Create Hash using SHA1Managed
/*//from w ww .ja va2 s .co m Copyright ?2009 John Allberg This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ using System.IO; using System.Security.Cryptography; using System.Diagnostics; using System; public class Main{ public static string CreateHash(byte[] bytes) { SHA1Managed sha1 = new SHA1Managed(); byte[] hashBytes = sha1.ComputeHash(bytes); return System.Convert.ToBase64String(hashBytes); } }