Ooops
March 05, 2021, 07:43:19 AM

Author Topic: [bmx] Tough Binary Encryption by Luke111 [ 1+ years ago ]  (Read 417 times)

Offline BlitzBot

[bmx] Tough Binary Encryption by Luke111 [ 1+ years ago ]
« on: June 29, 2017, 12:28:41 AM »
Title : Tough Binary Encryption
Author : Luke111
Posted : 1+ years ago

Description : If anybody can make a decoder for this, I will give you a cuban cigar. Just Kidding! Im new to this and this is my first BMAX code. I could not decrypt this, so I will let you guys.

Code :
Code: BlitzMax
  1. toen$ = Input$("> ")
  2. encbinenc(toen$)
  3. Function encbinenc(toencrypt$)
  4. writer = WriteFile("encrypted.txt")
  5. For a = 1 To Len(toencrypt$) Step 1
  6. b$ = Mid(toencrypt$,a,1)
  7. c = Asc(b$)
  8. d$ = Bin(c)
  9. For e = 1 To Len(d$) Step 1
  10.         f$ = Mid(d,e,1)
  11.         l = Asc(f$)
  12.         g$ = Hex(l)
  13.         For h = 1 To Len(g$) Step 1
  14.                 i$ = Mid(g$,h,1)
  15.                 j = Asc(i$)
  16.                 k$ = Bin(j)
  17.                 WriteLine writer,k
  18.         Next
  19. Next
  20. Next
  21. CloseFile(writer)
  22. reader = ReadFile("encrypted.txt")
  23. While Not Eof(reader)
  24. Print ReadLine(reader)
  25. Wend
  26. CloseFile(reader)
  27. Return 1
  28. End Function


Comments :


Jesse(Posted 1+ years ago)

 You should not be cluttering the code archives with stuff that is not complete. The code as it is does not really help much. Next time post it in its corresponding programming section and ask for help there. Once you figure it out, post it here.just to help you out, I figured it out:
Code: [Select]

Local toen:String = Input$("> ")
encript(toen)
decript()
Function encript:Int(toencrypt:String)
Local writer:TStream = WriteFile("encrypted.txt")
For Local a:Int = 1 To Len(toencrypt) Step 1
Local b:String = Mid(toencrypt,a,1)
Local c:Int = Asc(b)
Local d:String = Bin(c)
For Local e:Int = 1 To Len(d) Step 1
Local f:String = Mid(d,e,1)
Local l:Int = Asc(f)
Local g:String = Hex(l)
For Local h:Int = 1 To Len(g) Step 1
Local i:String = Mid(g,h,1)
Local j:Int = Asc(i)
Local k:String = Bin(j)
WriteLine writer,k
Next
Next
Next
CloseFile(writer)
Return 1
End Function

Function deCript()
Local reader:TStream = ReadFile("encrypted.txt")
If  reader = Null Print "unable To OpenFile"
Local str:String = Null
Local str2:String = Null
Local str3:String = Null
While Not Eof(reader)
Local s:String = ReadLine(reader)
Local a:Int = binStrToInt(s)
If str.length < 8
str :+Chr(a)
Else
str = Chr(a)
EndIf
If str.length = 8
If str2.length < 32
str2 :+ Chr(hexStrToInt(str))
Else
str2 = Chr(hexstrToInt(str))
EndIf
If str2.length = 32
str3:+ Chr(binStrToInt(str2))
EndIf
EndIf
Wend
Print str3
CloseFile(reader)

End Function

Function binStrToInt:Int(s:String)
Local v:Int = 0
For Local i:Int = 1 To s.length
v :| (Int(Mid$(s,i,1)) Shl (32-i))
Next
Return v
End Function

Function hexStrToInt:Int(s:String)
Local v:Int = 0
For Local i:Int = 1 To s.length
Local c:String = Mid$(s,i,1)
Local n:Int
If Asc(c) > 64
n = Asc(c) - 55
Else
n = Int(c)
EndIf
v :| (n Shl ((8-i)*4))
Next
Return v
End Function



Luke111(Posted 1+ years ago)

 And what would the corresponding section be?


Jesse(Posted 1+ years ago)

 Either BlitzMax Beginners Area or BlitzMax programming.


Luke111(Posted 1+ years ago)

 Ok I will do that next time [/i]

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal