Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

encrypt a password

Status
Not open for further replies.

vti

Technical User
Feb 26, 2001
189
TR
Hi,
Is there any tool or programe that i can make ascii characters to encrypted .All i want is i got eight characters and when i run the programe it has to give me an output as encrypted.


Thanks for any help.

 
There is a command called "crypt" which might do what you want. It does prompt you for a key though.

 
Is this related to awk somehow?

Here is a crummy substitution cipher
and validation program in awk:
Code:
function bad13(c,arr, xx,echar,p,ret) {
   if (!(length(c)) || (length(c)) > 8) {
       printf "Error: Cannot make a bad garble of this string"
       exit
   }

   ret = ""
   for (p=1 ; p <= length(c) ; p++) {
       echar = substr(c,p,1)
       for (xx in arr) {
           if (arr[xx] == echar) {
              echar = xx < 128 ? sprintf(&quot;%c&quot;, (xx + 13)) : sprintf(&quot;%c&quot;, xx = xx < (128 + 13) ? xx + 13 : xx)
              ret = ret echar 
           }
        }   
    }
return ret
}

function validatebad13(str,arr,str1, poo) {
str = bad13(str,arr)

          if (str == str1) {
              return 0
          }
return -1
} 
   
     


BEGIN {
var=&quot;&quot;
 for (i=0 ; i < 256 ; i++) {
      ascii[i] = sprintf(&quot;%c&quot;, i);
      #printf &quot;Translation for %d == %c\n&quot;, i, ascii[i]
 }
      while (var != &quot;q&quot;) {
            printf&quot;Enter a string to be badded(q to quit): &quot;
            getline var < &quot;-&quot;
            newvar = bad13(var,ascii)
            printf &quot;Bad produces: %s\n&quot;, newvar
            printf &quot;Enter password to validate: &quot;
            getline var < &quot;-&quot;
            printf &quot;Validate returns %d\n&quot;, validatebad13(var,ascii,newvar)
      }
}

Enjoy.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top