Thank you for the clarification. I got it: you are going in a wrong way.
If you really needed some integer arithmetic for
your own encryption algorithm, you would really need some big integer objects. Actually, under the hood, encryption algorithms use them. ([EDIT] No, I don't mean this exact structure is use: cryptography algorithm implementations are usually native, not .NET. [END EDIT]) But these big integers are much, much less then those you want to have. If you tried similar (or any, for this matter) encryption algorithms with the integer sizes you wanted, they would work, but with prohibitively low performance. Besides, chances are, you could come across some situations when
intermediate calculation result would occupy all available computer memory. With
BigInteger
, this is not easy but
very easy.
As you say you don't need this arithmetic, it makes you request totally pointless. On the public side of all cryptography algorithms, all data, with no exclusions, it represented as
byte[]
arrays.
And you need to learn how to abstract all that text encoding issued for data processing like cryptography. For that, you just need to understand how encoding works, and learn about Unicode, in particular. Just for the hints:
http://msdn.microsoft.com/en-us/library/system.text.encoding.aspx[
^],
http://en.wikipedia.org/wiki/Unicode[
^],
http://unicode.org/[
^].
Don't mix them up.
[EDIT]
HenryHunt wrote:
What I am trying to do is when someone signs in or fills in details to request an account it encrypts the entered data and sends it using WCF to another computer containing a database of accounts which it then decrypts the sent data…
Okay, but there is nothing special here. You need to use available encryption, more exactly, public-key cryptography:
http://en.wikipedia.org/wiki/Public-key_cryptography[
^].
You need to learn thoroughly why it works. The idea is: the server part should generate a key pair for each request and send the user a key for encryption. If this key is eavesdropped, someone else can only encrypt, but not decrypt, because it is done with a private key only stored on the server, never published. On next state, client encrypts the message and sends it. (Some kind of identification token can be used.) If it was HTTPS, you could use what is already supplied with an HTTP server (TLS), plus digital signing with the
certificate, always on server, optionally on client. Please see:
http://en.wikipedia.org/wiki/HTTPS[
^],
http://en.wikipedia.org/wiki/Transport_Layer_Security[
^],
http://en.wikipedia.org/wiki/Digital_signature[
^],
http://en.wikipedia.org/wiki/Digital_certificate[
^],
http://en.wikipedia.org/wiki/Certificate_authority[
^].
But you can do it all by yourself in a custom server.
Also, it's important to understand that, if you also need password protection, you should understand that 1) a password should not be stored anywhere (it's absolutely not needed for authentication and would violate at least privacy), 2) you would not need encryption, as
cryptographic hash function can be used. Please see my past answers:
i already encrypt my password but when i log in it gives me an error. how can decrypte it[
^],
TCP Connection with username and password[
^],
Decryption of Encrypted Password[
^],
storing password value int sql server with secure way[
^].
And you already have all algorithm implementations in .NET FCL, in particular:
http://msdn.microsoft.com/en-us/library/system.security.cryptography.asymmetricalgorithm%28v=vs.110%29.aspx[
^],
http://msdn.microsoft.com/en-us/library/system.security.cryptography.hashalgorithm.aspx[
^].
—SA