How to calculate md5 of a string in C#

Filed Under (c#, cryptography) by The Chef on 26-05-2009

Tagged Under : , , ,

If you have ever dared to write the md5 hashing algorithm in C#, you better stay calm because the MS guys thought of everything. It’s all in the framework. With just 2 lines of code the job is done. Take a look at the following piece of code:

String str="some text here";
MD5 md5 = new MD5CryptoServiceProvider();
String Hash = BitConverter.ToString(md5.ComputeHash(ASCIIEncoding.Default.GetBytes(str))).Replace("-","");

Easy, isn’t it ?

Roboticus predatorus

Filed Under (science) by The Chef on 18-05-2009

Tagged Under : , ,

The next generation of environment friendly robots are on the way. This “predator” robot needs flies to digest in order to create energy for movement. Although the distance covered after “eating” one fly is about couple of centimeters, the technology opens new perspective to fueling our vehicles.

How to count in windows bat files

Filed Under (script) by The Chef on 13-05-2009

Tagged Under : ,

This is a simple way to count form 0 to 1000 using bat files.

@echo off
if [%1]==[] goto NONE
if [%2]==[] goto ONE
if [%3]==[] goto TWO
goto THREE

:NONE
for %%x in (0 1 2 3 4 5 6 7 8 9) do call %0 %%x
goto DONE

:ONE
for %%x in (0 1 2 3 4 5 6 7 8 9) do call %0 %1 %%x
goto DONE

:TWO
for %%x in (0 1 2 3 4 5 6 7 8 9) do call %0 %1 %2 %%x
goto DONE

:THREE
echo %1%2%3
goto DONE

 :D ONE
Page 4 of 10« First...2345610...Last »