Thread: MD5
Hi, I was just wondering is it possible to encrypt a filed in the database with md5? i know it is possible to do it with DB users
On Fri, Dec 17, 2004 at 09:41:22AM +1100, Jamie Deppeler wrote: > I was just wondering is it possible to encrypt a filed in the database > with md5? i know it is possible to do it with DB users MD5 returns a hash, not an encrypted string that could later be decrypted. For an encryption mechanism see contrib/pgcrypto. -- Michael Fuhr http://www.fuhr.org/~mfuhr/
Hi, Am Freitag, den 17.12.2004, 09:41 +1100 schrieb Jamie Deppeler: > Hi, > > I was just wondering is it possible to encrypt a filed in the database > with md5? i know it is possible to do it with DB users No. You cannot encrypt with md5 because you cant decrypt. md5 is a hash function. But you can use it any time to hash values you insert. Regards Tino
Tino Wildenhain wrote: <blockquote cite="mid1103240237.5337.159.camel@Andrea.peacock.de" type="cite"><pre wrap="">Hi, Am Freitag, den 17.12.2004, 09:41 +1100 schrieb Jamie Deppeler: </pre><blockquote type="cite"><pre wrap="">Hi, I was just wondering is it possible to encrypt a filed in the database with md5? i know it is possible to do it with DB users </pre></blockquote><pre wrap=""> No. You cannot encrypt with md5 because you cant decrypt. md5 is a hash function. But you can use it any time to hash values you insert. Regards Tino </pre></blockquote> Well basically i want to store and hashed value that will never be changed just compaired too hashedvalues<br /><br /> also when i try to encrpyt a field i get this error encypt(text,"unknown","unknown")<br />
Use the md5 function: select md5('welcome'); md5 ---------------------------------- 40be4e59b9a2a2b5dffb918c0e86b3d7 (1 row) Regards, Chris Smith Suite 30, 45-51 Huntley St, Alexandria, NSW 2015 Australia Ph: +61 2 9517 2505 Fx: +61 2 9517 1915 email: info@interspire.com web: www.interspire.com Jamie Deppeler wrote: > Tino Wildenhain wrote: > >>Hi, >> >>Am Freitag, den 17.12.2004, 09:41 +1100 schrieb Jamie Deppeler: >> >> >>>Hi, >>> >>>I was just wondering is it possible to encrypt a filed in the database >>>with md5? i know it is possible to do it with DB users >>> >>> >> >>No. You cannot encrypt with md5 because you cant decrypt. >>md5 is a hash function. But you can use it any time to >>hash values you insert. >> >>Regards >>Tino >> >> >> >> >> > Well basically i want to store and hashed value that will never be > changed just compaired too hashed values > > also when i try to encrpyt a field i get this error > encypt(text,"unknown","unknown") > > > ------------------------------------------------------------------------ > > No virus found in this incoming message. > Checked by AVG Anti-Virus. > Version: 7.0.296 / Virus Database: 265.5.4 - Release Date: 12/15/2004 -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.296 / Virus Database: 265.5.4 - Release Date: 12/15/2004
(Ignore my other reply.. ;P) You'll need to import the pgcrypto.sql file (this creates the functions for you). Read the doco on how to install the extension, it should tell you where the sql file is. Regards, Chris Smith Suite 30, 45-51 Huntley St, Alexandria, NSW 2015 Australia Ph: +61 2 9517 2505 Fx: +61 2 9517 1915 email: info@interspire.com web: www.interspire.com Jamie Deppeler wrote: > Tino Wildenhain wrote: > >>Hi, >> >>Am Freitag, den 17.12.2004, 09:41 +1100 schrieb Jamie Deppeler: >> >> >>>Hi, >>> >>>I was just wondering is it possible to encrypt a filed in the database >>>with md5? i know it is possible to do it with DB users >>> >>> >> >>No. You cannot encrypt with md5 because you cant decrypt. >>md5 is a hash function. But you can use it any time to >>hash values you insert. >> >>Regards >>Tino >> >> >> >> >> > Well basically i want to store and hashed value that will never be > changed just compaired too hashed values > > also when i try to encrpyt a field i get this error > encypt(text,"unknown","unknown") > > > ------------------------------------------------------------------------ > > No virus found in this incoming message. > Checked by AVG Anti-Virus. > Version: 7.0.296 / Virus Database: 265.5.4 - Release Date: 12/15/2004 -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.296 / Virus Database: 265.5.4 - Release Date: 12/15/2004
[Please don't post in HTML] On Fri, Dec 17, 2004 at 10:55:47AM +1100, Jamie Deppeler wrote: > Well basically i want to store and hashed value that will never be > changed just compaired too hashed values In that case MD5 should suffice, although recently-discovered weaknesses have led some people to prefer SHA-1 or RIPEMD-160, which are available through contrib/pgcrypto. http://en.wikipedia.org/wiki/Md5 Your original question asked about encryption, so we gave answers based on that requirement. > also when i try to encrpyt a field i get this error > encypt(text,"unknown","unknown") Please show the SQL statement you executed and the complete, exact error message. Did you build and install pgcrypto? It's likely not installed on your system by default. -- Michael Fuhr http://www.fuhr.org/~mfuhr/
Am Freitag, den 17.12.2004, 10:55 +1100 schrieb Jamie Deppeler: > Tino Wildenhain wrote: > > Hi, > > > > Am Freitag, den 17.12.2004, 09:41 +1100 schrieb Jamie Deppeler: > > > > > Hi, > > > > > > I was just wondering is it possible to encrypt a filed in the database > > > with md5? i know it is possible to do it with DB users > > > > > > > No. You cannot encrypt with md5 because you cant decrypt. > > md5 is a hash function. But you can use it any time to > > hash values you insert. > > > > Regards > > Tino > > > > > > > > > Well basically i want to store and hashed value that will never be > changed just compaired too hashed values > > also when i try to encrpyt a field i get this error > encypt(text,"unknown","unknown") No, encrypt would not be md5. md5 hash is calculated via md5() which is built in on and above 7.3 I believe. If you need more/other functions, try contrib/pgcrypt or so - this is a couple of functions to implement encryption. (Depending on your installation, postgres-contrib might be a seperate package) Regards Tino