md5sum vs md5 – different algorithms?

Calculate md5 hash with md5sum, php, python and perl oneliners:

$ echo "hello" | md5sum 
b1946ac92492d2347c6235b4d2611184  -
$ php -r "echo md5('hello');"
5d41402abc4b2a76b9719d911017c592
$ python -c "import hashlib; print hashlib.md5('hello').hexdigest();"
5d41402abc4b2a76b9719d911017c592
$ perl -MDigest::MD5=md5_hex -e 'print md5_hex("hello") . "\n";'
5d41402abc4b2a76b9719d911017c592

And here will you have question – is md5sum (part of sys-apps/coreutils if you are using Gentoo) using some other algorithm to compute hash? Answer is no! It uses same algorithm, and problem lies not in md5sum itself but in echo.

Echo enters linebreak at the end of string. There is two solutions with echo command

$ echo -n "hello" | md5sum 
5d41402abc4b2a76b9719d911017c592  -
$ echo -e "hello\c" | md5sum 
5d41402abc4b2a76b9719d911017c592  -

In first case there is used parameter -n which says to echo – do not output the trailing newline.
In second case -e forces echo to accept backslash characters and \c ends output.

.. or use some other command to output string:

$ printf "hello" | md5sum 
5d41402abc4b2a76b9719d911017c592  -

.. or use md5sum in “read in” mode (after you have written ‘hello’ press Ctrl+D twice):

$ md5sum -t 
hello5d41402abc4b2a76b9719d911017c592  -

.. or write string into a file without linebreak:

$ md5sum password_file
Posted in Uncategorized | 3 Comments

labs.sasslantis.ee now officially online

just made change in old site’s config which is now redirected here.

Also added download directory for OpenSSL-GPU page with first/old version of code.

Posted in Uncategorized | Leave a comment

Office 2010 and embedded PDF

You may have a problem if you use Office 2010 and Acrobat Reader X and if you trying to insert pdf as OLE-object (for example) into Excel document.

Message which is displayed is like this:

cannot start the source application for this object

To solve this problem, open Acrobat Reader, and open Edit -> Preferences -> General and uncheck “Enable Protected Mode at startup”

Posted in Uncategorized | Leave a comment

WordPress and code

http://wordpress.org/extend/plugins/syntaxhighlighter/ is excactly what I need if going to post some code and shell scripts. Thanks to the developers.

Posted in Uncategorized | Leave a comment

Postfix, virutal users and password

So weird as it is.. I tried to find a way, how regular user could change his password and got no answer.

I have system set up like this: http://en.gentoo-wiki.com/wiki/Postfix,_Courier,_Squirrelmail_and_Spamassassin

All email-users are virtual and kept in mysql database. There is no commandline tool nor webapp support for this stack which would give to regular user way to change his password.

Superuser (root) can change password in this way:

authtest user@virtual.host.com oldpass newpass

Does anyone know easy way how to change password in database postfix uses? Next I’m trying to do, is to create additional plugin for roundcube.

Things I tried to search from google:
* courier-authlib change Cleartext password
* postfix admin (cool thing : http://postfixadmin.sourceforge.net/)
* postfix virtual users “change password”
* .. and many more

Edit 9.apr 2011
Found a way, how to do what I needed! You must enable password plugin in RoundCube, and edit following two variables

$rcmail_config['password_db_dsn'] = 'mysql://[dbuser]:[pass]@localhost/[database-name]';
$rcmail_config['password_query'] = 'UPDATE users SET clear=%p WHERE email=%u AND clear=%o LIMIT 1';

where dbuser and pass is for database where virtual-users for procmail are held

Posted in Uncategorized | Leave a comment

Microsoft’s layered software disturbs understanding problems

You trying to install piece of new software (Office 2010)

and suddenly pheww.. you got a message “The installation of this package has failed”

Whatta…? But ok, knowing software m$ produces – maybe that the problem of layers (or frontends) – one layer generates some error, and another tries to handle it.

Talking about this exe, when executed, it will be unpacked C:\Users\[username]\AppData\Local\Temp (atleast if using win7). You will also find setup.exe. Running this, a new error message: “The language of this installation package is not supported by your system”

and from logfile you will find:

Error: Installation of this product requires operating system supplemental language support. Type: 54::NoSupportedCulture.

You can go a full day around your computer and play with language/regional settings, but no there will be no cure.

But.. what if.. it is also layered message?

Run installation exe again, with /log parameter

Office2010.exe /log

and you get opatchinstall(1).log

from where you will find a new bit of information:

OPatchInstall: Extracting the file id ‘ProPlusWW.xml’ to the path ‘C:\Users\root\AppData\Local\Temp\OWP3F85.tmp\ProPlus.WW\ProPlusWW.xml’
OPatchInstall: Extracting the file id ‘ProPsWW.cab’ to the path ‘C:\Users\root\AppData\Local\Temp\OWP3F85.tmp\ProPlus.WW\ProPsWW.cab’
OPatchInstall: The extraction of the files failed
OPatchInstall: Setting system property ‘SYS.ERROR.INERROR’ with value ‘1’
OPatchInstall: Setting system property ‘SYS.ERROR.CODE’ with value ‘0x80004005’
OPatchInstall: Setting system property ‘SYS.ERROR.TYPE’ with value ‘HRESULT’
OPatchInstall: Setting system property ‘SYS.ERROR.ARG1’ with value ‘NONE’
OPatchInstall: Setting system property ‘SYS.ERROR.ARG2’ with value ‘NONE’
OPatchInstall: Setting system property ‘SYS.ERROR.ARG3’ with value ‘NONE’
OPatchInstall: Setting system property ‘SYS.ERROR.ARG4’ with value ‘NONE’
OPatchInstall: Setting system property ‘SYS.ERROR.ARG5’ with value ‘NONE’
OPatchInstall: Done executing action

Extraction failed? How? Why? IT WORKED few weeks ago!

And you will go and check out the md5sum of file, and find out – IT IS DIFFERENT!

Origin of the problem in my case
After little thinking I figured out, that I copied this exe after first using to external usb-HDD but filesystem there was already corrupted, and when moved to another location also this exe got corrupted, but not as much that it would say some running error… After geting new exe problem solved.

What to learn from this?
Software should be written in easy way, and if used layers/frontends – all of them should be able to display their messages in their/unmodified way.
And – don’t trust errormessages blindly.

Posted in Uncategorized | Leave a comment

Let’s go!

So, here it goes. This new blog has three main purposes and reasons which, as it turns out, I was not able to manage on other places.

Lots of code
In years I have developed lots of code and still creating new scripts weekly. Sometimes I need to create new thing and trying to find good implementations and references from older scripts, but that’s a lot of work to do if you must search from ten computers and from tens of directories. So, one way is to hold good and useful ideas in one place. Same applies to “linux commandline onelines”, sometimes used once in year, but every time need lots of searching.

WordPress, to ease management
I tried manage OpenSSL-GPU page as standalone html, but got tired. So, to concatenate flexibility of changing and ease to get users responses I choosed wordpress as new platform to create new site to hold and manage some pieces of code and scripts.

Google
I’m still thinking, that “out there” is only one search engine – Google, but as it’s grown and many people wants to get something, it has changed more demanding.

So – I tried Google’s adsense for year, even hoped soon to see first paycheck, as Google closed my acount. No reasons.. no feedback. I tried to fight but no results. In the same time I understand Google – there are millions of users .. can’t deal with all of them.

I created new acount, hoped to avoid some mistakes I made and hoped it works. It took a week, and Google closed my account again. Message was little different, but all I could figure out, is that Google likes original content (even tough I see every day lots of pages with copy-paste materials and adsense banners near, and that makes mad..).

So, this blog is partly to create what google wants – original content, and partly what I need to hold some code and articles .

Posted in Uncategorized | Leave a comment