Irreversible one-way function

Hi all,
I am creating a code which will perform a one-way irreversible function for protecting passwords. I don't want to use encryption methods, as this can be easily decrypted.
I have developed this code:
myString = 'hello, World';
ASCII = double(myString);
accum = 0;
m = 256^2;
hex = cell(size(ASCII));
for i=1:length(ASCII)
accum = (ASCII(i) + accum);
primeaccum = accum * 37;
modulus = mod(primeaccum,m);
hex{1,i} = dec2hex(primeaccum);
end
where 'hello,World' is sitting in place of the where the password would be input.
Please could you help provide any feedback/suggestions as to whether you think the code would work for this function?
Thanks, J

2 件のコメント

John D'Errico
John D'Errico 2015 年 3 月 31 日
I'm confused. It looks like you have a pretty simple scheme here, that to me does not look irreversible. As for the "simple encryption" methods you refer to, if they are as easily decrypted as you say, then why is this not? And why are there so many people working on RSI schemes and the like? Gosh, if it is so easy, then they are all just wasting their time.
Joseph Cheng
Joseph Cheng 2015 年 3 月 31 日
編集済み: Joseph Cheng 2015 年 3 月 31 日
well you would want to change your m to something smaller as it is doing nothing for you with that length of password. also use it in your calculation.
revhex=hex2dec(hex);
revprime=revhex/37;
revAscii(1)=revprime(1);
for i = 2:length(ASCII)
revAscii(i) = revprime(i)-sum(revAscii(1:i-1));
end
disp(char(revAscii))
the code snippit above is enough to backtrace what you've done. especially since revhex(1) is not adjusted by anything and can be used to find the other portions. with a bit of time someone could probably figure out that you've used 37 as a constant.

サインインしてコメントする。

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeEncryption / Cryptography についてさらに検索

質問済み:

2015 年 3 月 31 日

編集済み:

2015 年 4 月 1 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by