Jump to content
  • Advertisement
Sign in to follow this  
SelethD

bit operators

This topic is 5146 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I was wondering how you can use a bit operator to change data, then change it back again i want to this to work BYTE data = 'A' BYTE mask = 255 BYTE result = 0 result = data (bit operator) mask (result should hold a merged value of 'A' and 255) result = result (bit operator) mask (result should hold 'A' now) data == result Does that make any sense to anyone? If so, please tell me what bit operator would work here. Or how this is done if im just totally lost.

Share this post


Link to post
Share on other sites
Advertisement
Hi,

Well, that one's easy. Xor would do it for ya. Now question: why would you ever want to do something like that?

Vovan

Share this post


Link to post
Share on other sites
if you had a text file, and wanted to send it to someone, but wanted it scrambled, you could xor every byte, then wehen they get it, xor it again to reconstruct it.

is that a good way to do it?

Share this post


Link to post
Share on other sites
It's a way to do it. If it's just for fun in that secret decoder ring kinda way, then it's good enough. Or even if you're trying to keep the data unreadable by a specific person, it's good enough.

If you're trying to keep some important data safe from any random bozo online who might sniff the data when you send it, then you'd want to look into better encryption algorithms.

-Auron

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!