Sign in to follow this  

Directx 9 : Encrypting and Loading textures and Images

This topic is 2348 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

Hi,
I am looking to share my car game with Other people in my college.
I am currently using .X file as meshes and Textures in the bmp format.

But I would like to encrypt the data, so that it cannot be copied.
Can anyone please suggest that if i encrypt these files, then how do i load them as i am using standard Directx API's.

My data content is approx 300Mb.

Thanks in advance for your suggestion.

Share this post


Link to post
Share on other sites
[quote name='duskndreamz' timestamp='1310464951' post='4834212']
Hi,
I am looking to share my car game with Other people in my college.
I am currently using .X file as meshes and Textures in the bmp format.

But I would like to encrypt the data, so that it cannot be copied.
Can anyone please suggest that if i encrypt these files, then how do i load them as i am using standard Directx API's.

My data content is approx 300Mb.

Thanks in advance for your suggestion.
[/quote]

Well you can write your own ecryption algoritm and decrypt with the opposite before loading the actual file, you would need to LoadTextureFromMemory instead LoadTextureFromFile. You would just loaded the encrypted file in to memory and decrypt it there and then pass the pointer to the decrypted memory area to LoadTextureFromMemory.

However most games actaully ship their textures in DDS format which is not encrypted at all they just use custom package that bundle lots of textures together and that is why you can't view them. Most shaders are stored as precompiled shaders, but there are some games like Unreal that ship with shaders as text files just with a different extension then fx, cg, vs, ps, vert or frag extensions.

Share this post


Link to post
Share on other sites
Be aware that there are tools which can copy the data once it is uploaded to the graphics card, by which time your data is unencrypted, so strictly speaking this buys you very little.

If you bundle your resources in a zip file (which you can rename to obfuscate the file type, and optionally include some trivial XOR with a key to further obscure the zip file structure), and use something like PhysicsFS to load it, you can dissuade most casual attempts at copying your data, without wasting lots of time trying to keep out a determined attack (Which is not possible). Another upside is that loading compressed data takes less time from disk.

Regardless of what you do, consider using some form of compression on your images - PNG would be far better than distributing raw bitmap files.

Share this post


Link to post
Share on other sites

This topic is 2348 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this