Php & ruby: ruby analog of php md5 function

Trabla: Php & ruby: ruby equivalent ( analog ) of php md5 function



Php & ruby: ruby analog of php md5 function - screenshot 1


Solving:

1. PHP code:

<?php

$password = "trololo";

echo md5($password);

?>

Result:  37f62f1363b04df4370753037853fe88

Php & ruby: ruby analog of php md5 function - screenshot 2


2.  Ruby code:


// Require Ruby Standart Library 
// MD5 and SHA1 digest implementations.
require 'digest'

password = 'trololo'

// calculate md5 and print it
puts Digest::MD5.hexdigest( password ) 

Result:  37f62f1363b04df4370753037853fe88


Php & ruby: ruby analog of php md5 function - screenshot 3

No comments:

Post a Comment