<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  <CodeSnippet Format="1.0.0">
    <Header>
      <Title>One Way Hash for strings</Title>
      <Shortcut>OneWayHashforstrings</Shortcut>
      <Description>One Way Hash for strings [C#]</Description>
      <Author>Patrick Bounaix</Author>
      <HelpUrl>/PreviewSnippet.aspx?SnippetID=e61e0471-189a-4476-898b-2112955146f2</HelpUrl>
      <SnippetTypes>
        <SnippetType>SurroundsWith</SnippetType>
      </SnippetTypes>
    </Header>
    <Snippet>
      <Code Language="csharp"><![CDATA[#region OneWayHash
		/// <summary>
		/// Encrypts input string
		/// </summary>
		/// <param name="input">string</param>
		/// <returns>string</returns>
		public string OneWayHash(string input)
		{
			// convert pwd into hashed value //
			HashAlgorithm HA = new SHA1Managed();
			//declare a new encoder
			UTF8Encoding UTF8Encoder = new UTF8Encoding();
			//get byte representation of input text
			byte[] inputBytes = UTF8Encoder.GetBytes(input);
			//hash the input byte array
			byte[] output = HA.ComputeHash(inputBytes);
			//convert output byte array to a string
			string newString  = Convert.ToBase64String(output);
			return newString;
		}
		#endregion]]></Code>
    </Snippet>
  </CodeSnippet>
</CodeSnippets>