aboutsummaryrefslogtreecommitdiff
path: root/modules/base_installation/files/scripts/ldap_ssha
blob: cdbea1b2dd7190649b5dcf027be212d834053a5c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
#! /usr/bin/perl
use strict;
use Digest::SHA qw(sha1);
use MIME::Base64;

print 'Password: ';
system ( "stty -echo");
my $secret = <STDIN>;
chomp $secret;
my $salt;
$salt .= ('.','/',0..9,'A'..'Z','a'..'z')[rand 64] foreach(1..8);

print "\nHashed string for LDAP:\nuserPassword: {SSHA}" . encode_base64(sha1($secret . $salt) . $salt, '') . "\n";