LDAP passwort algorithm in R

Viewed 64

I am trying to encode Passwords for an LDAP-server-file (.LDIF) therefore I am trying to re-engineer a password in order to find the correct algorithm. I am working with R:

So here's the password I'm trying to replicate:

userPassword:: e1NIQX1XNnBoNU1tNVB6OEdnaVVMYlBnekczN21qOWc9

I know this password is "password" so here's my next step:

rawToChar(base64decode('e1NIQX1XNnBoNU1tNVB6OEdnaVVMYlBnekczN21qOWc9'))

this yields:

{SHA}W6ph5Mm5Pz8GgiULbPgzG37mj9g=

(I know this step was not necessary but I wanted to get a grasp of what was base64-encoded)

From my understanding this is an SHA-1 algorithm without SALT. So my next goal is to reproduce this in R by:

library(base64enc)
library(digest)

sha <- digest("password", "sha1", serialize = FALSE)
sha <- paste0("{SHA}", sha)
sha <- base64encode(charToRaw(sha))
sha
[1] "e1NIQX01YmFhNjFlNGM5YjkzZjNmMDY4MjI1MGI2Y2Y4MzMxYjdlZTY4ZmQ4" 

However this not similar to the password in the LDIF-File I was provided with. Any hint is greatly appreciated.

0 Answers
Related