Skip to content

Commit db10632

Browse files
committed
passwords: with cl-bcrypt
1 parent e8916f5 commit db10632

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

content/building-blocks/users-and-passwords.md

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,19 +55,28 @@ Did it work? Run `SELECT * FROM users;`.
5555

5656
## Encrypting passwords
5757

58-
### With cl-pass
58+
### With cl-bcrypt
5959

60-
[cl-pass](https://github.com/eudoxia0/cl-pass) is a password hashing and verification library. It is as simple to use as this:
60+
[cl-bcrypt](https://github.com/dnaeon/cl-bcrypt) is a password hashing and verification library. It is as simple to use as this:
6161

6262
```lisp
63-
(cl-pass:hash "test")
64-
;; "PBKDF2$sha256:20000$5cf6ee792cdf05e1ba2b6325c41a5f10$19c7f2ccb3880716bf7cdf999b3ed99e07c7a8140bab37af2afdc28d8806e854"
65-
(cl-pass:check-password "test" *)
66-
;; t
67-
(cl-pass:check-password "nope" **)
68-
;; nil
63+
CL-USER> (defparameter *password*
64+
(bcrypt:make-password "my-secret-password"))
65+
*PASSWORD*
6966
```
7067

68+
and you can specify another salt, another cost factor and another algorithm identifier.
69+
70+
Then you can use `bcrypt:encode` to get a string reprentation of the password:
71+
72+
~~~lisp
73+
CL-USER> (bcrypt:encode *password*)
74+
"$2a$16$ClVzMvzfNyhFA94iLDdToOVeApbDppFru3JXNUyi1y1x6MkO0KzZa"
75+
~~~
76+
77+
and you decode a password with `decode`.
78+
79+
7180
### Manually (with Ironclad)
7281

7382
In this recipe we do the encryption and verification ourselves. We use the de-facto standard

content/isomorphic web frameworks/weblocks.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ The Reblocks's demo we will build is a TODO app:
1313

1414
![](https://40ants.com/reblocks/images/docs/images/quickstart-check-task.gif)
1515

16-
---
1716

1817
{{% notice note %}}
1918

0 commit comments

Comments
 (0)