Skip to content

Commit 67f2a81

Browse files
author
Clément P
committed
[Function]: add the function PBKDF2
1 parent c224b04 commit 67f2a81

3 files changed

Lines changed: 5 additions & 7 deletions

File tree

srcs/pbkdf2/pbkdf2.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
/* By: cpieri <cpieri@student.42.fr> +#+ +:+ +#+ */
77
/* +#+#+#+#+#+ +#+ */
88
/* Created: 2019/12/31 13:29:35 by cpieri #+# #+# */
9-
/* Updated: 2020/01/02 14:11:49 by cpieri ### ########.fr */
9+
/* Updated: 2020/01/03 14:41:18 by cpieri ### ########.fr */
1010
/* */
1111
/* ************************************************************************** */
1212

@@ -63,7 +63,7 @@ static void *first_i(char *pass, char *salt, size_t y, t_prf prf)
6363
return (NULL);
6464
ft_memcpy(buff, salt, salt_len);
6565
*(uint32_t*)(buff + salt_len) = swap_uint32t((uint32_t)y);
66-
ret = prf.f(pass, ft_strlen(pass), buff, salt_len + 4);
66+
ret = prf.f(buff, salt_len + 4, pass, ft_strlen(pass));
6767
ft_memdel(&buff);
6868
return (ret);
6969
}
@@ -83,7 +83,7 @@ static void *pbkdf2_f(char *pass, char *salt, uint32_t c, t_prf prf, size_t y)
8383
blocks[0] = first_i(pass, salt, y, prf);
8484
else
8585
{
86-
blocks[i] = prf.f(pass, ft_strlen(pass), blocks[i - 1], prf.nb_word);
86+
blocks[i] = prf.f(blocks[i - 1], prf.nb_word, pass, ft_strlen(pass));
8787
pbkdf2_xor_dgst(blocks[0], blocks[i], prf.nb_word);
8888
}
8989
i++;
@@ -118,6 +118,5 @@ void *pbkdf2(char *pass, char *salt, uint32_t c, size_t dk_len)
118118
ft_memdel(&tmp);
119119
i++;
120120
}
121-
dprintf(0, "ret = %s\n", hex2sum((uint32_t*)ret, dk_len / 4));
122121
return (ret);
123122
}

srcs/symmetric/symmetric_parsing.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
/* By: cpieri <cpieri@student.42.fr> +#+ +:+ +#+ */
77
/* +#+#+#+#+#+ +#+ */
88
/* Created: 2019/05/06 12:04:37 by cpieri #+# #+# */
9-
/* Updated: 2020/01/02 14:13:17 by cpieri ### ########.fr */
9+
/* Updated: 2020/01/03 14:40:46 by cpieri ### ########.fr */
1010
/* */
1111
/* ************************************************************************** */
1212

@@ -47,7 +47,7 @@ static void check_pbkdf2(t_pbkdf **k)
4747
}
4848
else
4949
*k = new_key(get_pass("enter your password: "), 0, 0, 0);
50-
pbkdf2("password", "salt", 1, 20);
50+
pbkdf2("lol", "0", 1000, 20);
5151
}
5252

5353
static void get_sym_opt(char **av, int *now, t_opt *opt, t_pbkdf **k)

to_find_pbkdf2

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)