Skip to content

Commit b96660f

Browse files
committed
crypt: Add Bash and Python password encryption scripts
1 parent d2d7bff commit b96660f

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

crypt/my_crypt.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env python
2+
3+
import crypt
4+
5+
6+
PASSWORD = "anaaremere"
7+
ALG_TYPE = "6"
8+
SALT = "abcdefgh"
9+
10+
if ALG_TYPE == "5" or ALG_TYPE == "6":
11+
SALT = SALT + SALT
12+
13+
enc = crypt.crypt(PASSWORD, "$" + ALG_TYPE + "$" + SALT)
14+
print(enc)

crypt/my_crypt.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
PASSWORD="anaaremere"
4+
ALG_TYPE="sha-512" # des, md5, sha-256
5+
SALT="abcdefgh"
6+
7+
if test "$ALG_TYPE" = "sha-256" -o "$ALG_TYPE" = "sha-512"; then
8+
SALT="$SALT$SALT"
9+
fi
10+
11+
mkpasswd -m "$ALG_TYPE" -S "$SALT" "$PASSWORD"

0 commit comments

Comments
 (0)