LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-21-2014, 05:10 PM   #1
mreff555
Member
 
Registered: Sep 2011
Location: Philly
Distribution: Gentoo
Posts: 473

Rep: Reputation: Disabled
Linux login encryption


Hello,
I'm trying to teach myself a little more about encryption. I have been messing with the libcrypto++ libraries as well as some code for a SHA-512 algorithm I found here.
http://www.zedwood.com/article/cpp-sha512-function

So, I wrote a small program which compiles and appears to produce accurate hashes compared to a hash calculator I found here.
http://www.fileformat.info/tool/hash...0780yUc%2FMGjT

What I have been trying to determine in vein is what exactly do I have to do to produce the same hash that linux with a SHA-512 login does. I have been comparing to test accounts and have been unable to match the results.
I've read quite a few articles and they are very inconsistant but they seem to indicate I am supposed to be hashing <password> + <salt>, 5000 times.
Could someone explain a little more clearly what the standard hashing procedure for linux is?
 
Old 12-21-2014, 11:53 PM   #2
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
The /etc/login.defs file sets some configuration for login authentication like number of iterations, salt and choice of hash. And on most systems login is handled by shadow package. So seeing it's source may help.
 
Old 12-22-2014, 12:09 PM   #3
mreff555
Member
 
Registered: Sep 2011
Location: Philly
Distribution: Gentoo
Posts: 473

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by veerain View Post
The /etc/login.defs file sets some configuration for login authentication like number of iterations, salt and choice of hash. And on most systems login is handled by shadow package. So seeing it's source may help.
Yes I took a look at login defs the other day. Values for hash choice and iterations are not set so I assume they default to SHA-512 and 5000. I know it's SHA-512 for sure because the shadow file hashes begin with "$6$". I'll have a look at the source for the shadow package and see what I come up with.
 
Old 12-23-2014, 06:14 PM   #4
mreff555
Member
 
Registered: Sep 2011
Location: Philly
Distribution: Gentoo
Posts: 473

Original Poster
Rep: Reputation: Disabled
I hunted around in the shadow-utils source and traced it back to a crypt function which I was unable to locate the source

I found some python code which I don't entirely understand. It appears to be something along the lines of

password+salt+password+???

The source is here near the bottom. Can someone translate?

I'll take a low level language any day. Python may be fast but it's confusing.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux password encryption and data encryption Tux-Slack Programming 4 06-20-2007 06:46 AM
Linux Encryption rino.caldelli Linux - Security 16 08-26-2005 03:11 PM
Linux Encryption matux Linux - Security 4 01-29-2005 08:03 PM
Remote VNC Login Encryption dsschanze Linux - Software 1 12-23-2004 07:26 PM
Mandrake 9.0 Wireless Works without encryption.. does not with encryption topcat Linux - Wireless Networking 3 05-04-2003 08:47 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:40 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration