crypt

Need help with brute force code for crypt(3)

徘徊边缘 提交于 2019-12-02 08:54:47
问题 I am trying to develop a program in C that will "crack" the crypt(3) encryption used by UNIX. The most naive way to do it is brute forcing I guess. I thought I should create an array containing all the symbols a password can have and then get all possible permutations of them and store them in a two-dimensional array (where all the 1 character passwords get's saved in the first row etc.) through for loops. Is there any better way to do this? It's pretty messy with the loops. 回答1: Assuming

How to get Perl crypt to encrypt more than 8 characters?

时光毁灭记忆、已成空白 提交于 2019-12-02 02:04:32
问题 Only the first 8 characters is encrypted when the Perl crypt function is used. Is there a way to get it to use more characters? As an example: $crypted_password = crypt ("PassWord", "SALT"); and $crypted_password = crypt ("PassWord123", "SALT"); returns exactly the same result. $crypted_password has exactly the same value. Would love to use crypt because it is a quick and easy solution to some none reversible encryption but this limit does not make it useful for anything serious. 回答1: To

`password_verify` call returning false for correct password

筅森魡賤 提交于 2019-12-01 23:20:17
I have the following snippet of code: // bcrypt hash of 'password' $hash = '$2y$10$4u0cQ.WEnwHDo.C5Nl1vm.shKA0beQ32wqzphSfzklAq9OcDM2nLu'; if(password_verify('password', $hash)) { print_r('woohoo!'); } else { print_r('fubar'); } On one server it's working fine (woohoo!), on another it doesn't work. I've just put it up on codepad.org and it fails there too. The problem is (as can be see on that codepad page) that the hash computed by crypt is of length 13 instead of the required 60. I'm using ircmaxel's password_compat library on github to implement the PHP 5.5 only password_verify function. It

php的加密函数 md5,crypt,base64_encode 等使用介绍

試著忘記壹切 提交于 2019-12-01 23:18:42
php 在做注册、登录或是url 传递参数时都会用到 字符变量的加密,下面我们就来简单的介绍下:php 自带的加密函数 不可逆的加密函数为:md5()、crypt() md5() 用来计算 MD5 哈稀。语法为:string md5(string str); crypt() 将字符串用 UNIX 的标准加密 DES 模块加密。这是单向的加密函数,无法解密。欲比对字符串,将已加密的字符串的头二个字符放在 salt 的参数中,再比对加密后的字符串。语法为:string crypt(string str, string [salt]); 可逆转的加密为:base64_encode()、urlencode() 相对应的解密函数:base64_decode() 、urldecode() base64_encode() 将字符串以 MIME BASE64 编码。此编码方式可以让中文字或者图片也能在网络上顺利传输。语法为string base64_encode(string data); 它的解密函数为:string base64_decode(string encoded_data); 将复回原样 urlencode() 将字符串以 URL 编码。例如空格就会变成加号。语法为:string urlencode(string str); 它的解密函数为:string urldecode

Storing bcrypt hashes

拥有回忆 提交于 2019-12-01 09:40:32
问题 According to PHP's doc, bcrypt salt are made of "$2a$", a two digit cost parameter, "$", and 22 digits from the alphabet "./0-9A-Za-z" So, if i use the crypt() function to hash my passwords, the resulting output include the first 7 chars ($2a$10$, if 10 is the cost parameter) as a part of the salt - and, according to all examples i was able to find across the internet, this complete output is written to db. I'm wondering what's the point in storing those first characters with the rest of the

How to replicate hash_hmac('sha256', $key, $secret_key) function in Swift 4?

假装没事ソ 提交于 2019-12-01 09:33:57
I've tried generating the hash_hmac('sha256', $key, $secret_key) php function equivalent in Swift 4 without success, after using libraries like CommonCrypto, CryptoSwift. I need these function for API authentication, using Alamofire library, which is a great library. Since i use Swift 4 the compatibility with other Swift libraries is not so good. Even with CryptoSwift which has the latest version(0.7.1) for Swift 4 i still get a lot of compatibility errors likes enter image description here Swift 3/4: HMAC with MD5, SHA1, SHA224, SHA256, SHA384, SHA512 (Swift 3) These functions will hash

Storing bcrypt hashes

杀马特。学长 韩版系。学妹 提交于 2019-12-01 09:31:32
According to PHP's doc, bcrypt salt are made of "$2a$", a two digit cost parameter, "$", and 22 digits from the alphabet "./0-9A-Za-z" So, if i use the crypt() function to hash my passwords, the resulting output include the first 7 chars ($2a$10$, if 10 is the cost parameter) as a part of the salt - and, according to all examples i was able to find across the internet, this complete output is written to db. I'm wondering what's the point in storing those first characters with the rest of the salt and the encrypted data. Their meaning is fully clear to me, but i can't really understand why such

How to replicate hash_hmac('sha256', $key, $secret_key) function in Swift 4?

一笑奈何 提交于 2019-12-01 06:02:24
问题 I've tried generating the hash_hmac('sha256', $key, $secret_key) php function equivalent in Swift 4 without success, after using libraries like CommonCrypto, CryptoSwift. I need these function for API authentication, using Alamofire library, which is a great library. Since i use Swift 4 the compatibility with other Swift libraries is not so good. Even with CryptoSwift which has the latest version(0.7.1) for Swift 4 i still get a lot of compatibility errors likes enter image description here

undefined reference to `crypt'

一笑奈何 提交于 2019-12-01 03:49:41
I am using the below code that i found somewhere in the net and i am getting an error when i try to build it. The compilation is ok. Here is the error: /tmp/ccCnp11F.o: In function `main': crypt.c:(.text+0xf1): undefined reference to `crypt' collect2: ld returned 1 exit status and here is the code: #include <stdio.h> #include <time.h> #include <unistd.h> #include <crypt.h> int main() { unsigned long seed[2]; char salt[] = "$1$........"; const char *const seedchars = "./0123456789ABCDEFGHIJKLMNOPQRST" "UVWXYZabcdefghijklmnopqrstuvwxyz"; char *password; int i; /* Generate a (not very) random

Self Service Password 密码策略

落爺英雄遲暮 提交于 2019-11-30 21:17:22
1.在活动目录中新建一个用户,并赋予域管理员权限; 2.拷贝conf目录下的config.inc.php为config.inc.local.php; 3.按自己的实际情况及要求修改config.inc.local.php文件中的相关参数,说明如下: <?php #============================================================================== # LTB Self Service Password # # Copyright (C) 2009 Clement OUDOT # Copyright (C) 2009 LTB-project.org # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in