阅读背景:

如何在Mac OS X中获得与Linux gcc/gnu crypt(3)相同的crypt(3)函数?Linux gcc crypt(3)有MD5和SHA512。苹果Gcc密码(3)*只使用DES

来源:互联网 

I am migrating some c code from Linux to Mac OSX (yosemite). The Mac OSX crypt() function (which is in unistd.h, as I have determined), is not the same as on gcc/gnu in Linux. I have test programs on Linux and Mac OSX, and the crypt() c-library function displays a 34-character string, if you display result using printf. The same code on the Mac OSX, displays only a 13 char string. A bit of research suggests that the difference is apparently the Linux crypt() library routine generates the hash from longer vectors on the gnu/gcc Linux side, using perhaps a different encryption algorithm. Some information also suggests that the Apple Mac OSX c-library crypt() function is only using DES to encrypt the original string plus the salt. I want to have my test code produce the same results, on both Linux and Mac OSX platforms.I am migrating some c code from Linux to Mac OS




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: