LinuxQuestions.org
Review your favorite Linux distribution.
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 09-13-2004, 01:09 AM   #1
pantera
Member
 
Registered: May 2004
Posts: 80

Rep: Reputation: 15
converting string to asterisks


how can i convert a string or a character to asteriks
i have a program that gets the login name and password
i need to save the password to a file in ***** format
 
Old 09-13-2004, 01:31 AM   #2
itsme86
Senior Member
 
Registered: Jan 2004
Location: Oregon, USA
Distribution: Slackware
Posts: 1,246

Rep: Reputation: 59
If you convert the string to *'s then the password becomes a string of *'s...that doesn't make for a very secure password.
 
Old 09-13-2004, 02:27 PM   #3
aluser
Member
 
Registered: Mar 2004
Location: Massachusetts
Distribution: Debian
Posts: 557

Rep: Reputation: 42
In general, if the program needs to read the password as its original form from this file, there is not a secure way to store it. (You need to rely on filesystem permissions.) On the other hand, if the program needs only to verify that a typed password matches the one "stored" in the file, you can do it by storing a hash of the original in the file. MD5 and SHA1 are two algorithms you could use to do this; they'll be in most any crypto library. You can use crypt(3), but it's not very strong.

If the point of this is just to keep your kid sister from reading the data, and not actually to be secure, you can do some trivial transform to the password before storing it, e.g. memfrob(3).
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Converting a steam from an input file to a String byteframe Programming 6 10-10-2005 09:08 PM
converting a int to string irfanhab Programming 6 07-30-2005 10:40 PM
Converting a string from /etc/passwd liguorir Linux - Software 3 04-13-2004 03:32 PM
C# trouble converting from string to double. exodist Programming 2 02-24-2004 12:38 AM
Converting a paragraph into a one-line string ganninu Linux - General 4 12-03-2003 08:50 AM

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

All times are GMT -5. The time now is 06:05 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration