Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
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("%c", (xx + 13)) : sprintf("%c", 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=""
for (i=0 ; i < 256 ; i++) {
ascii[i] = sprintf("%c", i);
#printf "Translation for %d == %c\n", i, ascii[i]
}
while (var != "q") {
printf"Enter a string to be badded(q to quit): "
getline var < "-"
newvar = bad13(var,ascii)
printf "Bad produces: %s\n", newvar
printf "Enter password to validate: "
getline var < "-"
printf "Validate returns %d\n", validatebad13(var,ascii,newvar)
}
}