Introducing BinaryService [ALPHA]!

BinaryService

BinaryService is a module that can currently encrypt and decrypt numbers as binary. :1234:

It supports any number, not in string form, and will convert it with the given values(defaults to 1 and 0). :one: :zero:

Current Methods:

Methods Github Page

BinaryService:numberToBinary()

BinaryService:numberToBinary(number, AVal, BVal)


BinaryService:binaryToNumber()

BinaryService:binaryToNumber(Binary, AVal, BVal)


Current Version: 0.1.0-alpha

Download ^

Planned Features:

  • Add Multi-Character Support for Encrypting and Decrypting
  • Add String-To-Binary and Binary To String Support
  • Add a Shuffle Algorithm to further encrypt Binary (will be optional)
7 Likes

this isnt even needed, u can do this already, also its not even fast the way your doing it

How would you do it then? Keep in mind to support different values for 1 and 0.

1 Like

why would anyone want to change the binary digits in the first place?

If you were sending the Binary over, it could confuse people trying to see and sensitive data will be safer, also could have things like the A, B values should only be used in x place, any others will not enter, also helping stop people from throwing in their own values.

it would be pretty easy to tell, plus if its for security theres way better options then turning ur numbers into binary.

This could also be used as a game mechanic, like inputting binary and using the converted number.

yeah theres faster ways to convert to binary etc if you dont use the replacer ( not that its hard to do, u can just use gsub)

i will admit, the current thing is probably not the most efficient, but i have not yet finished the main parts, and once that happens(multi-character support), i will rework it a bit to make it less messy and more efficient.

So basically this is a binary encoder? Since the encoded numbers will be strings, why not use something like base64 encoding so the string size is significantly less and arguably harder to decode?

Edit: I have no problem with this, it’s just unnecessary because Luau is already a high level language. Binary doesn’t really have any applications in this level.

The BinaryToNumber thing could be simplified (and I assume optimised), using

tonumber(number, 2)
OR
tonumber(`0b{number}`)

-- (it isn't a typo in the above one - it just is that way)

where number is the binary value (e.g. 10110)

2 Likes

I don’t use this module, but I have my own binary module and my use is for setting/reading individual bits is for my virtual machine. There are times where I need to access only one bit at a time, like for CPU flags (I have them as binary values) or sometimes you can use a byte for multiple things, so you need to read different parts of the byte

theres literally inbuilt roblox functions for this stuff

Who knows, maybe someone wants binary numbers in there game and is to lazy to just write out all the numbers in binary. And heck theres probably more cases where it could be used, you never know why someone might like it

theres way faster ways of converting to and from binary

true, but if there wasnt then this could be very valuable