Monday, October 1, 2012

Unsigned Int

When using C++ iterators [ for(int i=0;i<key.length();i++) ], if you declare i to be an unsigned int, it effectively doubles the length of the array you can travel through.

Type Name Bytes Other Names Range of Values
int 4 signed –2,147,483,648 to 2,147,483,647
unsigned int 4 unsigned 0 to 4,294,967,295


As far as the Vigenere cypher is concerned, this allows you to process twice as much text.

1 comment:

  1. Good tip, although we won't be dealing with messages anywhere near that long!

    ReplyDelete