MD5: Difference between revisions

Content deleted Content added
m whitespace
Updated D versions
Line 333: Line 333:


=={{header|D}}==
=={{header|D}}==
<lang d>import std.stdio, std.md5;

void main() {
ubyte[16] digest;
auto txt = "The quick brown fox jumped over the lazy dog's back";
sum(digest, txt);
writeln(digest.digestToString());
}</lang>
Output:
<pre>E38CA1D920C4B8B8D3946B2C72F01680</pre>
Alternative version:
{{libheader|Tango}}
{{libheader|Tango}}
<lang d>module md5test ;
<lang d>import tango.io.digest.Md5, tango.io.Stdout;

import tango.io.digest.Md5 ;
import tango.io.Stdout ;
void main(char[][] args) {
void main(char[][] args) {
auto md5 = new Md5() ;
auto md5 = new Md5();
for(int i = 1 ; i < args.length ; i++){
for(int i = 1; i < args.length; i++) {
md5.update(args[i]) ;
md5.update(args[i]);
Stdout.formatln("[{}]=>\n[{}]", args[i], md5.hexDigest()) ;
Stdout.formatln("[{}]=>\n[{}]", args[i], md5.hexDigest());
}
}
}</lang>
}</lang>
Output:
Sample output:
<pre>>md5test "The quick brown fox jumped over the lazy dog's back"
<pre>>md5test "The quick brown fox jumped over the lazy dog's back"
[The quick brown fox jumped over the lazy dog's back]=>
[The quick brown fox jumped over the lazy dog's back]=>