EG Information

Main Index
EG Manual
Disclaimer
Legal Information
Hall of Fame
Hall of Shame
Member Rankings
Members List
Meet the Staff

Training Missions

Read Me First New
Basic Skills
Realistic Scenarios
Cryptography
Software Cracking
Linux ELF Binary Cracking
Logical Thinking
Programming
Patching
Steganography
Deface This Wall
/dev/null
/dev/urandom

Knowledge Bank

Discussion Forums
Enigma Chat New
RSS Feeds RSS
Articles / Tutorials
Videos
Online EG MP3 Player Radio
Enigma Zine
Downloads
Tools New

Code Resources

Submit Code
Ajax
ASM
Bash
C
CPP
Csharp
Delphi
Haskell
Java
Javascript
Jython
Lisp
mIRC
MySQL
Perl
PHP
Python
QBASIC
VisualBasic

Hakipedia: An open collaborative for all your information security needs.

The Urinal

Click Here To Vote For EG!

Has Enigma Group Helped You? Then Help Us By Advertising For Us. Place One Of The Following Images On Your Site.

enigma group

enigma group

enigma group

enigma group

Enigma Group's Code Bank


passwd.pl

By: toast  -  Date Submitted: 2009-05-17 04:49:09

  1. #=======================================================================================#
  2. # Written by: Toast #
  3. # #
  4. # Name : passwdgen.pl #
  5. # #
  6. # Random password generator will let the user choose how long the passwd will be if not #
  7. # specified it will default to 10 characters #
  8. # #
  9. # It will also print the MD5 Hash and SHA1 Hash of the password #
  10. # #
  11. # Written under Slackware 12.2 tested and working #
  12. #=======================================================================================#
  13.  
  14. use strict;
  15. use warnings;
  16.  
  17. use Digest::MD5 qw(md5_hex);
  18. use Digest::SHA1 qw(sha1_hex);
  19.  
  20. my $passwd;
  21. my $rand;
  22.  
  23. # Password Length
  24. my $passwd_length = $ARGV[0] ;
  25. if (!$passwd_length ) {
  26. $passwd_length = 10;
  27. }
  28.  
  29. # Characters that will be used to generate the random password
  30. my @chars = split ( " ", "q w e r t y u i o p a s d f g h j k l z x c v b n m Q W E R T Y U I O P A S D F G H J K L Z X C V B N M 1 2 3 4 5 6 7 8 9 0 ! @ $ % ^ & # * ( ) + - = | / < > ~ ` : ; [ ] { } | , . ? _") ;
  31.  
  32. for (my $i=0; $i<$passwd_length ;$i++) {
  33. $rand = int(rand 91);
  34. $passwd .= $chars[$rand];
  35. }
  36. # Prints the generated password to the screen
  37. print "Your new password is: $passwdn";
  38.  
  39. # Hashes the password to MD5 and print to screen.
  40. my $md5_hash = md5_hex($passwd);
  41. print "The MD5 Hash is: $md5_hashn";
  42.  
  43. # Hashes the password to SHA1 and prints to the screen.
  44. my $sha1_hash = sha1_hex($passwd);
  45. print "The SHA1 Hash is: $sha1_hashn";
Return to perl category list

Who's Online

483 Guests, 101 Users
ckryptix, Ios, viper0i0, Diznablo, rabbidmind, asapong, Nasrudin, CollapsingWalls, mehtaparag, bitstrike, jnony, C, Nicid1, Nusquam-Redono-Sapientia, bazcrown, saifulfaizan, The End, Ultraminor, psychomarine, st3alth, themastersinner, pgmrlink, login, lionaneesh, ishkur88, mahraja, Mac, chekifr, gandalf88, Vap0r, t0ast, tantrum6226, BnE, Distorted, Psiber_Syn, Ausome1, invas10n, oldgoat, freedaysbecumei, BinaryShinigami, Rex_Mundi, Red_beard, Strobeflux, s0m3nak3dguy, Descent, teehee, machupicchu, Genetix, Anandarl, NotMyOwn, thegamerdude, Godzila, popo12341234, RedEvolution, velocity_b, myne17, teto111, aVoid, Central-Gsm, 1101, JackalReborn, InjectioN, h4lted, c0re, DisPater, markt4death, splatta, Jackowacko, saint556, Pyron2312, Azerion, howsens, white.hat.gone.bad, vazzilly, pwunkz, Inverted, QuarterCask, Infernoe11, deskata, cr4ck3rj4ck, Blizer, jasonmax, j0sh, gwenwavor, N4g4c3N, spizeyboy, Network X, Uino59, Jae Cee, ianFDK, saykov, medhaavee, zofy, demonkiller410, Stumble, SaMTHG, kishore, Raze, helasraizam, Venom1019, Jakabo