Jump to content

_QNEM (Quick Numeric Encryption Method)


Recommended Posts

this is not nesicarly what i planned on making but the idea simply came to me.

my only problem is i have no idea how to un encrypt this xD.

if there is no way could this be considered a one way hashing algorithm?

THE PASSWORD MUST BE NUMERIC

Func _QNEM($xtext, $xpassword, $xlevel)
    global $output
    if $xlevel > 10 Then
        msgbox(28, "ERROR", "QNEM ERROR:"&@crlf&"Encryption Level Range Excceded")
        Exit
    EndIf
$xarray = StringSplit($xtext, "")
for $x=1 to UBound($xarray)-1
$output = $output&asc($xarray[$x])
Next

    $xencr = $xlevel&"."&$xpassword
$output = $output * $xencr
    Return $output
EndFunc
Edited by NightxStalker
Link to comment
Share on other sites

  • Moderators

Well to be honest, it doesn't make any sense. If my password is abc and my level is 2, $xencr = 2.abc ... so you're multiplying output by 2.abc.

And if the value gets too large, you won't get the correct output on a decryption level anyway.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

sorry for not clarifying THE PASSWORD MUST BE NUMERIC

Still remains the issue that if the output numerical value before multiplied by the xencr variable is too large it won't work. (In other words, if you have a string you want to encrypt that is 200 characters long, you'll get some return like #INF).

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Couple things I can see here:

- your password has to be a number (if not a number then your multiplication fails and the return is 0)

- by converting your text in ASCII you will end up with huge numbers (4 characters will be at least a 8 digit long number) -> you won't be able to encrypt strings longer than ... let's say 10 characters (maybe less)

- multiplying that number by another value will result in an even bigger number (so far I've seen AutoIt returning the scientific representation of the result; it might return the full number though) -> scientific representation = not accurate at all -> not accurate result = impossible to correctly decrypt

- the text cannot contain any @CR or @LF because this will be confusing the decryption

Speaking about decryption:

- without the level and password there is no way to decrypt this without using brute-force

- if you have these 2 it is possible to retrieve the original text (not very easy but doable)

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Link to comment
Share on other sites

Adjusted to allow decryption.

This is very very breakable "encryption" though.

$string = "test string!!!"
$pass = "p@ssw0rd"
$level = 5

$QEMString = _QEM($string, $pass, $level)
MsgBox(0, "QEM", $QEMString)
MsgBox(0, "UNQEM", _UNQEM($QEMString, $pass, $level))

Func _QEM($xtext, $xpassword, $xlevel)
    If Not IsNumber( $xpassword ) Then $xpassword = StringTrimLeft(StringToBinary( $xpassword ), 2)
    If $xlevel > 10 Then
        MsgBox(28, "ERROR", "QEM ERROR:" & @CRLF & "Encryption Level Range Excceded")
        Exit
    EndIf
    $output = ''
    $xencr = $xlevel & "." & $xpassword
    $xarray = StringSplit($xtext, "")
    For $x = 1 To UBound($xarray) - 1
        $output = $output & Asc($xarray[$x]) * $xencr & "|"
    Next
    Return $output
EndFunc   ;==>_QEM

Func _UNQEM($xtext, $xpassword, $xlevel)
    If Not IsNumber( $xpassword ) Then $xpassword = StringTrimLeft(StringToBinary( $xpassword ), 2)
    If $xlevel > 10 Then
        MsgBox(28, "ERROR", "QEM ERROR:" & @CRLF & "Encryption Level Range Excceded")
        Exit
    EndIf
    $output = ''
    $xencr = $xlevel & "." & $xpassword
    $xarray = StringSplit($xtext, "|")
    For $x = 1 To UBound($xarray) - 1
        $output = $output & Chr(Round($xarray[$x] / $xencr))
    Next
    Return $output
EndFunc   ;==>_UNQEM
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...