Re: urgnet need for complete C# code for Password encryption/decryption

From: Dejan Sarka (dejan_please_reply_to_newsgroups.sarka_at_avtenta.si)
Date: 05/17/03


Date: Sat, 17 May 2003 16:10:29 +0200


I agree - hashing is becoming nearly a standard.

-- 
Dejan Sarka, SQL Server MVP
FAQ from Neil & others at: http://www.sqlserverfaq.com
Please reply only to the newsgroups.
PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org
"Amir Eshterayeh" <aeshterayeh@hotmail.com> wrote in message
news:uqSkZxDHDHA.1828@TK2MSFTNGP10.phx.gbl...
> Thank you so much. I have found the following information from
>
> http://www.dotnet247.com/247reference/msgs/1/8366.aspx
>
> which is said it is better to user hashing instead of encryption for
> password coding.
>
> I will be happy to know your idea cause I need to apply it today :)
>
> Best Regards
> Amir Eshterayeh
> ----------------------------------------------------
>
> Phillip Pratt [@interact.com]
> What you are talking about is hashing, not encrypting. A hash algorithm
> is a
> one-way function (There's no way to get the original back from the
> hash), an
> encryption algorithm is a two-way function. Other than that distinction,
> though what you are doing is the way to go. A hash is the appropriate
> method
> for storing passwords because there is never a reason to get back the
> original. Also with a hash function, the output size is predetermined
> and
> independent of the input size (20 Bytes in the case of SHA1). This makes
> choosing a datatype in a database pretty easy. And as far as hashing
> algorithms go, SHA1 is a good one.
>
> Here's an example using a text box to get the input value:
>
> UnicodeEncoding enc = new UnicodeEncoding();
>
> byte[] plainbytes = enc.GetBytes(textBox1.Text);
>
> SHA1 sha = new SHA1CryptoServiceProvider();
>
> byte[] result = sha.ComputeHash(plainbytes);
>
> You may want to then encode the result byte array to some sort of text
> encoding (Base64 perhaps?) or just leave it as a byte array for storage.
>
> Hope this helps.
>
> "Harris Boyce III" <hboyce@thedotworks.com> wrote in message
> news:#bqayu7TBHA.1860@tkmsftngp05...
> [Original message clipped]
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!


Relevant Pages

  • Re: Probabalistic algorithms.
    ... >Hashing is typically just an optimisation. ... all the hash does is guarantee that given some ... >hard to factor the composite into its two prime factors. ... >algorithm that's dfaster than brute force factorisation, ...
    (comp.lang.pascal.delphi.misc)
  • Probabalistic algorithms.
    ... *really* cool algorithm that is *vital* to most of the computing world ... Hashing is typically just an optimisation. ... all the hash does is guarantee that given some ... Now the problem is that if you want to generate a composite that's ...
    (comp.lang.pascal.delphi.misc)
  • Re: to sig or not to sig?
    ... >> this block which will make the whole file generate the same hash as ... > hashing 2^m random messages. ... Finding two random messages that hashe to ... I guess what I wanted to know here was whether the md5 algorithm had been ...
    (comp.os.linux.misc)
  • Re: "index" efficiency... any help or ideas?
    ... no general purpose hashing method, no matter how good, is good enough ... to prevent the possibility that everything hash into the same place. ... > Downside of hashes; if the data is stored externally, ... > perfect hashing are techniques that require analysis of the data in advance, ...
    (alt.lang.asm)
  • Re: A question on an article dealing with pass phrase and keys
    ... In the section Keys vs. Passphrases He mentions using a hashing ... first and it goes through the hash function first. ... Hashing the passphrase to produce a key will not increase ... This can be useful for various crypto applications, ...
    (sci.crypt)