I have to store a string (non-numeric, can contain any UTF8 Chars) in a BigInteger to perform some Mathematical operations with it. I need the conversion to be deterministic which
BigInteger mybigint = new BigInteger(mystring.getBytes());
does not seem to be…
Also I need to be able to convert it back from BigInteger to String. If I convert a String to BigInteger and back it needs to be identical afterwards.
Does anyone have an Idea how to do that?
Thank you in advance!
This IS deterministic :
And you can revert it using
I can’t exclude there is some kind of usefulness to this process but if you’re not sure don’t hesitate to mention why you do this.