Very experimental commit but gonna dev on my pc for a bit

This commit is contained in:
monqui 2026-05-22 17:38:09 -04:00
parent 8059244ef8
commit db47aabe1c
4 changed files with 47 additions and 15 deletions

View file

@ -14,7 +14,7 @@ class ImageUtils
@@password = pass
@@message = msg
if msg.length > 400 then
if msg.length > 1024 then
puts "Maximum length exceeded. Exiting."
exit
end
@ -34,9 +34,32 @@ class ImageUtils
h = Digest::SHA512.hexdigest(@@password)
s = @@pixelImg.getSalt
merge_to_i = h + s
@@hash = Digest::SHA512.hexdigest(self.interlaceHash(h, s))
end
@@hash = Digest::SHA512.hexdigest(h+s)
def interlaceHash(h1, h2)
puts h1
puts h2
h1 = self.getBits(h1)
h2 = self.getBits(h2)
interlaced = 0
while h1.to_i > 0 and h2.to_i > 0 do
interlaced = (interlaced << 1) | (h1 & 1)
h1 = h1 >> 1
interlaced = (interlaced << 1) | (h2 & 1)
h2 = h2 >> 1
# puts interlaced
# puts h1
# puts h2
end
puts interlaced.to_s.inspect
return interlaced.to_s
end
def generateLookupTable
@ -78,4 +101,16 @@ class ImageUtils
return tbl
end
def getBits(o)
msg_bytes = o.unpack("c*")
msg_bits = 0
for b in msg_bytes
msg_bits = (msg_bits << 8) | b
end
return msg_bits
end
end