///<summary> /// Encrypts passed value using passed key. ///</summary> /// Key can be generated automatically using GenerateKey(). /// \sa Decrypt(), GenerateKey() publicstaticintEncrypt(intvalue, int key) { returnvalue ^ key; }
///<summary> /// Decrypts passed value you got from Encrypt() using same key. ///</summary> /// \sa Encrypt() publicstaticintDecrypt(intvalue, int key) { returnvalue ^ key; }
///<summary> /// Encrypts passed value using passed key. ///</summary> /// Key can be generated automatically using GenerateKey(). /// \sa Decrypt(), GenerateKey() publicstaticintEncrypt(intvalue, int key) { value = value ^ key; value = right_rotate((uint)value, key % 10); // offset 1 value = value ^ key; value = right_rotate((uint)value, key % 100000 / 10000); // offset 5 value = value ^ key; returnvalue; //return value ^ key; }
///<summary> /// Decrypts passed value you got from Encrypt() using same key. ///</summary> /// \sa Encrypt() publicstaticintDecrypt(intvalue, int key) { value = value ^ key; value = left_rotate((uint)value, key % 100000 / 10000); value = value ^ key; value = left_rotate((uint)value, key % 10); value = value ^ key; returnvalue; //return value ^ key; }