Sponsored Content
Top Forums Shell Programming and Scripting how to encrypt a string using md5 Post 302521825 by Perderabo on Thursday 12th of May 2011 11:31:18 AM
Old 05-12-2011
Strictly speakly you can't encrypt anything with md5 because it's not an encryption algorithm. Ignoring that, you can use the digest command that appeared on Solaris 10.

On Linux:
Code:
$  echo hello | md5sum
b1946ac92492d2347c6235b4d2611184  -
$

And on Solaris 10:
Code:
$ echo hello | digest -a md5 /dev/fd/0
b1946ac92492d2347c6235b4d2611184
$

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Md5

Does anyone know a scipt that includes MD5. I need to run a script that includes MD5 encryption. Thanks (1 Reply)
Discussion started by: duncang3
1 Replies

2. Shell Programming and Scripting

Encrypt & Decrypt a String

Hi Everybody, I have a script that telnet another system. For some reasons, this is should be done by "root", so the root password has been written explicitly in this script, which mean any body read this script will know the root password of the other system. I think the solution is to write... (6 Replies)
Discussion started by: aldowsary
6 Replies

3. UNIX for Dummies Questions & Answers

Hashing or MD5

Hi, how can one find that which encryption algorithm the system is using for keeping the user password in the /etc/passwd or /etc/shadow file. Is it 1: Hashing ( which considers only first 5 letters of password) 2: MD5 (Which allows arbitry length passwords) Thanks, ~amit (0 Replies)
Discussion started by: amit4g
0 Replies

4. Programming

md5 hash a string or char array in SCO

Can someone provide me with code to md5 hash a string or character array in the SCO environment. All help is appreciated thanks. (5 Replies)
Discussion started by: jcarter2333
5 Replies

5. Shell Programming and Scripting

Encrypt/Decrypt string with rsa keys

Hello, I wanted to know if there was a way to encrypt a string, not a file using openssl and then decrypt it? I cant seem to get it to work. This is what I have been trying but I'm not having much luck. encTxt=`echo "$1" | openssl dgst -sha1 -binary | openssl rsautl -sign -inkey... (1 Reply)
Discussion started by: tjones1105
1 Replies

6. Linux

Need Help: MD5

I am trying to compare two identical files by using md5 command, but cant get the right command parameters Please help me with any examples. All I want is to know how to compare two identical files which are residing on two different machines in my local network, for example: Host_A -... (6 Replies)
Discussion started by: greenja
6 Replies

7. Shell Programming and Scripting

Help with md5 in PERL

I am a newbie in programming in Perl. My problem is that this unix command is embedded in Perl but it gives an empty output. Here's the code: $temp = `md5 "../Directory String/..." | awk {'print $NF'} > "../Directory/file.txt"`; The output file should contain the md5 hash value of the... (2 Replies)
Discussion started by: ianebaj
2 Replies

8. Shell Programming and Scripting

Encrypt and decrypt a string

Hi, I want to encrypt and decrypt a string(database password) which will be used in my scripts. encrypt the string while storing in a file and while using it in other scripts it should decrypt. i tried below method. As it can decrypt easily, it is not recommended. encrypt=`perl -e 'print unpack... (5 Replies)
Discussion started by: rohan10k
5 Replies

9. Shell Programming and Scripting

Create md5 sums and archive the resulting md5 files

Hello everyone, I am looking to basically creating md5sum files for all iso files in a directory and archive the resulting md5 files into a single archive in that very same directory. I worked out a clumsy solution such as: #find files for which md5sum are to be created and store the... (1 Reply)
Discussion started by: SurfTranquille
1 Replies

10. Shell Programming and Scripting

How to reverse the b64 format(encoded b64(b64(md5($pass)))) into md5 hash format?

I have about 1500 rows (encoded b64(b64(md5($pass))) algorythm) in a file. I would like reverse the b64 into md5 hash format. How could I do that from command line? So I need only the correct md5 hash formats. These row format: 4G5qc2WQzGES6QkWAUgl5w P9tKxonBOg3ymr8vOBLnDA... (1 Reply)
Discussion started by: freeroute
1 Replies
HASH(3) 								 1								   HASH(3)

hash - Generate a hash value (message digest)

SYNOPSIS
string hash (string $algo, string $data, [bool $raw_output = false]) DESCRIPTION
PARAMETERS
o $algo - Name of selected hashing algorithm (e.g. "md5", "sha256", "haval160,4", etc..) o $data - Message to be hashed. o $raw_output - When set to TRUE, outputs raw binary data. FALSE outputs lowercase hexits. RETURN VALUES
Returns a string containing the calculated message digest as lowercase hexits unless $raw_output is set to true in which case the raw binary representation of the message digest is returned. CHANGELOG
+--------+---------------------------------------------------+ |Version | | | | | | | Description | | | | +--------+---------------------------------------------------+ | 5.4.0 | | | | | | | The tiger algorithm now uses big-endian byte | | | ordering. See also example below. | | | | +--------+---------------------------------------------------+ EXAMPLES
Example #1 A hash(3) example <?php echo hash('ripemd160', 'The quick brown fox jumped over the lazy dog.'); ?> The above example will output: ec457d0a974c48d5685a7efa03d137dc8bbde7e3 Example #2 Calculate pre PHP-5.4 tiger hashes with PHP-5.4 and higher <?php function old_tiger($data = "", $width=192, $rounds = 3) { return substr( implode( array_map( function ($h) { return str_pad(bin2hex(strrev($h)), 16, "0"); }, str_split(hash("tiger192,$rounds", $data, true), 8) ) ), 0, 48-(192-$width)/4 ); } echo hash('tiger192,3', 'a-string'), PHP_EOL; echo old_tiger('a-string'), PHP_EOL; ?> Output of the above example in PHP 5.3: 146a7492719b3564094efe7abbd40a7416fd900179d02773 64359b7192746a14740ad4bb7afe4e097327d0790190fd16 Output of the above example in PHP 5.4: 64359b7192746a14740ad4bb7afe4e097327d0790190fd16 146a7492719b3564094efe7abbd40a7416fd900179d02773 SEE ALSO
hash_file(3), hash_hmac(3), hash_init(3), md5(3), sha1(3). PHP Documentation Group HASH(3)
All times are GMT -4. The time now is 03:56 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy