在iPhone上使用OpenSSL生成passwd

在iPhone上使用OpenSSL生成passwd,iphone,openssl,passwd,Iphone,Openssl,Passwd,我有OpenSSL库在我的iPhone上运行良好,可以创建哈希等。。。我只是想知道如何在应用程序中创建一个salt密码,使其与以下内容的输出相匹配: openssl passwd-crypt-salt xxxxxxxxxxx密码 我正在库中查找“passwd”函数,但似乎找不到一个 谢谢 下面是一个移动到答案块中的数字答案: 好的,我有答案。。。您只需执行以下操作: const char *password = [[NSString stringWithFormat:@"passwordstri

我有OpenSSL库在我的iPhone上运行良好,可以创建哈希等。。。我只是想知道如何在应用程序中创建一个salt密码,使其与以下内容的输出相匹配:

openssl passwd-crypt-salt xxxxxxxxxxx密码

我正在库中查找“passwd”函数,但似乎找不到一个


谢谢

下面是一个移动到答案块中的数字答案:

好的,我有答案。。。您只需执行以下操作:

const char *password = [[NSString stringWithFormat:@"passwordstring"] UTF8String];
const char *salt = [[NSString stringWithFormat:@"saltstring"] UTF8String];

const char *passwd = crypt(password, salt);

NSString *theToken = [NSString stringWithUTF8String:passwd];

NSLog(@"%@", theToken);

EZMode。

好的,我想出来了。我没有意识到有一个“crypt()”函数可用,它已经实现了我想要的功能。对于其他人,只需使用以下命令:constchar*passwd=crypt(password,salt);