This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
AndreWalia's profile picture

WalCrypt (should be called WalHash)

Started by AndreWalia, 22 November 2014 - 12:16 AM
AndreWalia #1
Posted 22 November 2014 - 01:16 AM
WalCrypt

Hashing algorithm






WalCrypt is a hashing algorithm I made to improve my skills. I have decided to release it to the forums today because I think it is secure.

If you feel up to it please try to crack my hashing algorithm and please post how you did so. I hope you get lots of use out of WalCrypt.



Code, for those people who dont use pastebin
--# walCrypt by Andre A. Walia (walia6)
--# liscensed under CreativeCommons Attribution.
--# You may distribute,remix, tweak, and build
--# upon my work, even commercially, as long as
--# you credit me by my First, middle initial, and last name.


function walCrypter(toHash)
  a={}
  for i=1,#toHash do
	a[#a+1] = string.sub(toHash,i,i)
  end
  b = {}
  c = 0
  x={}
  for k,v in pairs(a) do
	x[#x+1] = string.byte(v)
  end
  for k,v in pairs(x) do
	math.randomseed(k)
	c=c+math.random(1,v)
  end
  d=0
  for k,v in pairs(x) do
	math.randomseed(c)
	d=math.random(1,k)
	math.randomseed(v)
	d=d+math.random(1,v)
  end
  math.randomseed(c)
  f=math.random(1,#a)
  ending = ""
  for i=1,f do
	math.randomseed(x[#x])
	x[#x+1] = math.random(1,i)
  end
  for k,v in pairs(x) do
	ending = ending..v
  end
  ended = 0
  ending=ending..""
  for i=1,#ending do
	ended = ended + tonumber(string.sub(ending,i,i))
  end
  return tonumber(ending)/tonumber(ended)
end 


Please leave reviews!


-Cheers!

please leave feedback
Edited on 24 November 2014 - 12:03 AM
civilwargeeky #2
Posted 24 November 2014 - 12:32 AM
I don't really know much about encryption or anything, but does this just encrypt data with no way to decrypt it?
KingofGamesYami #3
Posted 24 November 2014 - 12:50 AM
My feedback: this is useless.

I compared the results several times over, using this:

for i = 1, 10 do
	print( walCrypter( "HI" ) == walCrypter( "HI" ) )
end

Out of the ten printed statements, 5 were true and 5 were false.

Raw results:

true
false
false
false
true
false
true
true
false
true

In conclusion: this has a 50/50 chance of matching itself, making the hash entirely useless.
AndreWalia #4
Posted 25 November 2014 - 11:54 PM
My feedback: this is useless.

I compared the results several times over, using this:

for i = 1, 10 do
	print( walCrypter( "HI" ) == walCrypter( "HI" ) )
end

Out of the ten printed statements, 5 were true and 5 were false.

Raw results:

true
false
false
false
true
false
true
true
false
true

In conclusion: this has a 50/50 chance of matching itself, making the hash entirely useless.

I have not been able to reproduce this. Do you mind telling me if you are using an emulator/what version of cc you are using
KingofGamesYami #5
Posted 26 November 2014 - 12:03 AM
-snip-
I have not been able to reproduce this. Do you mind telling me if you are using an emulator/what version of cc you are using

I used Mimic.

Edit: I just tested with MC 1.7.10, CC 1.65. It works fine with that for reasons unknown.
Edited on 25 November 2014 - 11:09 PM
AndreWalia #6
Posted 26 November 2014 - 12:19 AM
Ah, ok that's what i thought.
Now that it works for you, any feedback?
KingofGamesYami #7
Posted 26 November 2014 - 12:48 AM
Alright I guess, I don't know much about this sort of thing. However, it seems impossible to get the original content back, which is the idea behind hashing. Although this works, I will continue to use GravityScore's sha256 port, if only because it's a hash thats been tested against real hackers, and held.