Answer the question
In order to leave comments, you need to log in
Is there a chance to get the same key with different data and is it possible to crack the key?
Is it possible that using this algorithm you can get two identical keys, but with different data? And if so, what is the likelihood of that? And is it possible to crack the key?
import random
def _gen_salt(msg):
salt = 0
for x in msg:
salt = ord(x) ** len(msg)
salt = salt + salt - len(msg) * salt
return salt
def _crypt(msg, bits=64):
# Stage 1 string
enc = ""
# Stage 2 string
val = ""
# Salt
salt = _gen_salt(msg)
# Key
key = random.randint(12, 1247)
# Stage 1
for c in msg:
val = 500 - ord(c)
# IDK how it works, just random operators
val = str(hex(int(
salt * val + val - key * key ^ key ** val * val
)))
enc += val[3:][:128] + "-"
# Stage 2
for x in enc.split("-"):
if x:
val += str(hex(int(
int(x, 16) * salt * key % key
)))
# Parse encrypted string
val = val.replace("0", "").replace("x", "")
val = val[::2] + val
val = val[:128] + val[:512:salt - key]
val = val[::3] + val[::2] + val
# Fix size
if len(val) < bits:
pos = 1
while len(val) < bits:
if len(val) >= bits:
break
val += val[::pos]
pos += 1
if pos > 100:
pos = 1
# Return encrypted string
return val[:bits] + val[:bits:2]
def crypt(msg, bits=128):
# Encrypt string and fix string length, if possible
enc = _crypt(msg, bits).replace("-", "")[:bits]
return enc, len(enc)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question