Jump to content
  • Advertisement
Sign in to follow this  
NexusOne

[.net] I need a 256-bit integer

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

Advertisement
Out of curiosity, why do you need to store numbers as large as 115792089237316195423570985008687907853269984665640564039457584007913129639935?

Share this post


Link to post
Share on other sites
Quote:
Original post by Roboguy
Out of curiosity, why do you need to store numbers as large as 115792089237316195423570985008687907853269984665640564039457584007913129639935?


Most likely for encryption purposes.

Bob

Share this post


Link to post
Share on other sites
Pretty weak encryption. Typically encryption libraries that need to manipulate large integers (such as RSA) use an integer library that allows for arbitrary sizes; The simplest method is a string integer library [integers stored and manipulated as ASCII strings]. More complex, but much faster, is a chunked integer library (i.e. stores integer as 64bit chunks representing specific digit ranges)

Share this post


Link to post
Share on other sites
Actually, it's for a Chess AI, for storing a unique ID to a chess board state. I need at least 132 bits even after using Huffman encoding to completely represent a board in int form, which means even a 128-bit int is too small.

Share this post


Link to post
Share on other sites
Ok, it's 4 am, so I'm not going to argue about whether you need a 256 bit int for that. (One question that springs to mind, though, what are you going to do with all these states? It's not like you'd even be able to fit a single bool for each state on your HD. Just storing the ID's would take more harddrives than I care to count. 132 bits is a lot. And if you can't associate any data with the different states, then what good are they?)

But if you do go with this, it sounds like you wouldn't need to do any math on them, only comparisons (to see if it's the same id).
So wouldn't it be easier to just make a struct or array of 8 ints (or 5 ints should do), and then just compare each of them, rather than setting up big math libraries?

Share this post


Link to post
Share on other sites
that's a good point, I'll just use a struct. By the way, I don't need to store every state, i'm just using these unique IDs to compare whether the state that I get back from a certain hash table location really is the state I want, because there are so many states there's bound to be collisions. Thanks

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!