Not quite right of MD5

Hiya.

I'm porting the code php I wore originally from Python which implies the hash of a password and salt together in MD5, which works very well for the PHP and Python, but it is not working properly in java.
I took the salt that 2 other programs use to test and it's right half but the moment that the MessageDigest Digest, it changes.

I use the following in java:

MessageDigest m = MessageDigest.getInstance ("MD5");
m.Reset ();
String saltString = convertHexToString (salt);
System.out.println (saltString);
String passwordAndSalt = saltString + password;
m.Update (passwordAndSalt.GetBytes ("UTF8"));
ubyte bytes [] = m.digest ();

to do
$pwHash = md5 ($salt. $password, true);
$pw = strtoupper (bin2hex ($pwHash));
in php, and
m = md5.new)
m.Update (Salt)
m.Update (Password)
return m.digest)

in Python.

Byte [] produced by the MessageDigest is different from the format raw PHP and the result of pythons, which means that the HEXADECIMAL value that results is different, and I can't understand why.
Any help would be appreciated. Thank you

String saltString = convertHexToString (salt);

If you have salt in hexadecimal and you are converting it to a string.

System.out.println (saltString);
String passwordAndSalt = saltString + password;
m.Update (passwordAndSalt.GetBytes ("UTF8"));

And here you convert this back to bytes after you add the password.

Don't, don't. String is not a container for binary data. Use an array of byte []. Use two, one for the salt and the other for the password and call update() once with each.

Tags: Java

Similar Questions

  • Calc help.  Something is not quite right

    Hi all

    We get unexpected results of a Calc. The first calc runs as expected for the 53190 element and the Member account 515000 gets settled.

    DIFFICULTY (Budget, "53190", "013", "no product", "Jan", "amount")
    "No program")
    If (@ISCHILD ("Labor_Job class"))
    '515000' = 500;
    ENDIF;
    )
    ENDFIX

    This second calc fails to set the Member account for the element 51111 515000.
    DIFFICULTY (Budget, "51111", "013", "no product", "Jan", "amount")
    "No program")
    If (@ISCHILD ("Labor_Job class"))
    '515000' = 500;
    ENDIF;
    )
    ENDFIX

    What things could cause this. I can put in place the elements in the excel add-in. We are here perplexed.

    Thank you

    Is there data to 013, in any combination of dense dimension?

    If not, try
    CREATEBLOCKONEQ PUT forward your assignment.

    The FIX on @CHILDREN did not solve this problem, just a more effective approach.

    Kind regards

    Cameron Lackpour

  • CSS Sprites not quite right

    Howdy all,
    After attending TODcon2007, I was inspired to rewrite one of my sites using CSS Sprites and includes. The URL, sprites and CSS annex worked fine until I set up includes it the file to store the DIVs sprites. The footer works very well as an inclusion. Will that be someone Puh-leeze let me know what I did wrong. The first window in the tavern should display 'over the Tavern '.
    The new homepage of the tavern

    Never mind. This has been a very long day. I missed the reference to the DIV missing in inclusion. All better... and really cool.

  • I can not longer right click my desktop or in a folder and get a new Forlder.

    I am running Windows 7 and I can not longer right click my desktop or in a folder and get a new Forlder.  My only option is a "new compressed folder (zip file)" the only thing I added to my computer (that I know) is Norton Internet Security.

    How to remove and restore the default context Menu items 'New' in Windows 7 and Windows 8
    http://www.SevenForums.com/tutorials/28677-new-context-menu-remove-restore-default-menu-items.html
     
     
     
    I do not think Norton is responsible for this, but it's quite the security program user-friendly Windows less you could choose and often causes other issues.
     

     
     
  • Direct tracing is not look right

    Hello

    I don't use Illustrator a lot at all so I do not know how to do much out there. Try to turn a logo in a vector image. I used the track live and after its expansion, it just isn't quite right. I don't know if there is something I can do with the settings to change that or not. I need help.

    Kevin.jpg

    It is therefore part of our logo for the work. Here's what the text looked like after going through live followed.

    scott.jpg

    Any idea on how to do it without losing any quality in the text? Thanks for your help.

    Thanks for the help. I know what it is and it looks like this on purpose actually. It is a small part only of an older logo. At some point I'll recreate, but for now I just need to do something for her. I thought about it and did. Whoever made it up he is in a very strange way so I had to come up with my own way to essentially fix, but your advice will be useful for the next time.

  • How can I change the sound alarm on Apple Watch for night stand mode?  Light ping is not quite disturbing to wake me up.  Are there different sounds?

    The sound of the alarm on the Apple Watch is not quite disturbing to wake mode bedside table.  Are there different sounds/tones that I choose? Where can I do this? Or y at - it app for Apple Watch Nightstand that will provide different alarm signals?

    Hello

    It is not currently possible to customize ringtones for alarm on Apple Watch.

    If you want Apple to consider adding this option, you can fill out and submit the form here:

    https://www.Apple.com/feedback/watch.html

  • I want my categories to bookmarks to open on the left, not the right.

    When my favorites opens and I go to a subcategory, they open on the right side of the page and I would like to make them open on the left side of the page. Also, there is a large gap between the subject and the arrow of sub categories, such as about eight inches across the page. They bring closer that sometimes when I move the arrow all the way through to the triangle that comes out the subcategory he shifts to an another subcategory.
    Thanks for your help.

    Who did reduce the width of the page, but it didn't help me find ways make the subtopic open on the left side, not the right as it does now. He did this Fire Fox update itself. Thanks for the initial information if the part worked. Aloha

  • When connecting on MacMini, password is auto-complete with a myriad of points and is not the right password

    When connecting on MacMini after I click on the user, the password field is auto-complete with a myriad of points and is not the right password.

    There suddenly / maybe after the most recent update 2015-008, which I installed it on 8 January 2016.

    I need to delete points, usually I can remove them by double clicking on it and pressing the delete key, but they will not simply remove by clicking in the field and using the delete key, as would be normal. Sometimes it takes a few tries to remove the points, and then I can connect.

    Does my keyboard or a virus, my usb port, the update of security or something else...?

    I use this computer without problem for a few years.

    Thank you, Kathy

    osX version 10.9.5 processor 2.3 GHz intel core 17

    First try another KB

    Next

    -Try to reset memory NVRAM/PRAM and SMC

    MacIntel: Reset of the controller (SMC) system management

    Subject of memory NVRAM and PRAM

    -Try to start safe mode

    OS x: what is Safe Boot, Safe Mode?

    -Start to recovery and repair the startup disk

    OS X: on OS X Recovery - Apple Support

    -If it is repairable reinstall the OSX

    How to reinstall OS X on your Mac - Apple Support

    -If you do not have a backup using disk utility to restore the internal drive to an external drive, so that you can try to recover the data.

    Format the boot disk and then do a fresh install of Mac OS x

  • When starting my computer will not have right to windows is said by pressing F1 or F2, he also says to look for floppy drive 0 failure

    When starting my computer will not have right to windows is said by pressing F1 or F2, he also says to look for floppy drive 0 failure

    It is a message from the BIOS. You can press F2 and go into BIOS and select "set as default" then save and exit. The PC actually has a floppy drive?

  • try to get out of the Setup Wizard mode and secure windows not installed right

    in the Middle using my wireless mouse, my laptop has slipped into my keyboard and my mouse is not responding. I tried to reinstall the ihome cd and I get an error saying my computer is in safe mode or my windows installation wizard is not installed right?

    Hey ludovicrohr,

    It would be possible that the Windows Installer is damaged. Follow the suggestions in the article given below to repair windows installer issues.

    How to troubleshoot issues that may occur when you install, uninstall, or upgrade one program on a Windows computer
    http://support.Microsoft.com/kb/2438651/en-us

    Once it is resolved, try the installation and see if your keyboard and mouse started working.

    Kind regards

    Shinmila H - Microsoft Support

    Visit our Microsoft answers feedback Forum and let us know what you think.

  • type of product key and he says that's not the right number

    I typed in the product key, but he says that's not the right number.  I checked it several times.  It's a HP Windows Vista Home Premium.

    As HP shipped computers with Windows preinstalled, it is likely that you are using the incorrect product key. The Windows product key is usually in a label in the computer chassis, while the office is usually available to a box or envelope.

  • Envy 4500: Envy 4500 does not print right

    I have and HP Envy 4500 for a month that she was fine, then all of a sudden I tried to print and no matter what I print from a site is now not printing right.  I tried to re-align the book to help... I ran a printer status report, but it has not released correctly.  I know there is a problem, but don't know how to fix... Please help.

    Can you be more specific in the description of what happens when you try to print?

    In general, the following link contains the print quality issues.  Only the where I would start, but it would be helpful to understand what the print pages look like.  Click on the link to see if one of the solutioins on this page could help describe what happens when you try to print.  Your solution may be on this page, if it's a matter of print quality.

    Print quality troubleshooting

  • Windows 7 Upgrade, saying that it is not the right disc

    I have the HP Windows 7 upgrade CD of 2009 and I'm trying to install it on my genuine HP laptop. First of all, I inserted the CD that is labeled insert everything first. After that everything was checked, I was then asked to insert the upgrade CD, I did, but then I received a notification that the disc I inserted is not the right disk. The CD I'm insertion is the support for Windows 7 Home Premium Upgrade, two CDs have been sent to Microsoft. Is there something I'm missing or is there a way I can work around this problem.

    Looking forward to any help, thank you.

    Note: Running Windows Vista

    Moved from Vista to install, upgrade and activate Forum.

    You try to upgrade to the wrong architecture.

    When important changes to your computer, for example an upgrade, it is always recommended that you back up your system before installing a new version of Windows. In your case, you can upgrade to Windows 7 depending on the edition and the architecture of Windows Vista, you have installed. If you are running a 32-bit version of Vista and upgrade to a 64-bit (Windows 7 edition) version, you'll have a pure make install, it is the opposite case.

    If you are using Windows Vista Home Basic or Premium consumer editions, you can only upgrade to Windows 7 Home Premium or Ultimate. In addition, you can make downgrades, which means, if you are running Windows Vista Ultimate Edition now, you cannot downgrade to Windows 7 Home Premium. You perform logical upgrades:

    Windows Vista Home Basic > Windows 7 Home Basic, Premium or Ultimate

    Windows Vista Edition Home Premium > Windows 7 Home Premium or Ultimate

    Windows Vista Business > Windows 7 Professional, enterprise or ultimate edition

    Windows Vista Business > Windows 7 Enterprise

    Windows Vista Ultimate > Windows 7 Ultimate.

    My PC running the 32-bit version or 64-bit Windows?

    http://Windows.Microsoft.com/en-us/Windows7/find-out-32-or-64-bit

  • Sign in with the account of Microsoft - the service is not available right now - please try again later.

    Original title: cannot connect Yoga 11 on behalf of Microsoft (Win RT)

    Hi all

    A week ago, I bought the new Lenovo IdeaPad Yoga 11, win RT

    All air well excluding the following problem: I couldn't move the laptop to my Microsoft account.
    Currently, the laptop is connected to the local account, but that does not allow me to use SkyDrive and MS Store.

    I tried on:
    Went to Setup, press the button, then I asked to provide my local password and then my email.

    Finally, the white rectangle appeared for half a minute about, and then following message will appear:
    Connect with the Microsoft account.
    The service is not available right now - please try again later.

    I tried for a week, to no avail.

    I don't know that my Microsoft account works well. I can connect using a web browser.

    I called Lenovo support, but they won't help me because, as they say, they have no idea about the problems of Microsoft. And they directed me to MS support.

    So I called MS support service, they told me that they do not support Windows RT. As they say: Windows RT IS NOT a MICROSOFT PRODUCT, every HW vendor built for her own use he wants. And they sent me to the support of Lenovo.

    Catch-22. Deadlock.
    ... ...

    Everyone faced with similar problem?
    What would you suggest?

    Thank you in advance!

    PS. It was also a problem with the activation of Windows. Finally I did over the phone.

    Finally, I managed to switch to MS account. The date of the laptop was wrong.

    The issue is closed.

    A big thank you to all and especially in Aïssa B Ganesh

    Concerning

    Vitali

  • Not quite OK in preview, but page.

    If one of the pages of my mobile site isn't quite right in preview mode, but looks fine in a browser

    should I worry about this.

    If your page looks good in a browser, you're ready.

Maybe you are looking for

  • How can I clear all data on sync and start over?

    When I get my favorites the way I would like it on my computer and delete the ones I don't want that it is messed up. I have 4 computers on my account and every time I sync it evokes the old bookmarks. I deleted all the bookmarks from my computer and

  • Alternative text does not not on a Mac, works on other

    I use the native ability of text replacement for Mac OS X and have been for some time.  (Preferences-> keyboard-> 'Text')  I am running OS X El Capitan 10.11.5.  Text replacement functions do not currently work.  To resolve this problem, I tried to r

  • Tecra 9000 reload Windows XP

    I'm trying to reload my Tecra 9000 with Windows XP sp2. The CD I have another OEM but I guess it's always the same and so I should be able to use this copy? Basically, all charges fine but displays 3 yellow question mark dots Device Manager... 1 is M

  • Satellite sometimes does not detect the wireless network

    Hello My laptop Satellite sometimes does not detect wireless networks and the only thing I can do is to restart my computer, is there a solution for this?

  • events triggering not on value change

    Is there a problem to have several event facilities in a VI that handle the same event? Specifically, I have a stacked sequence where in an image, there is an event loop (structure of the event in awhile put in loop) which manages the user interface