Quake II RTX doxygen  1.0 dev
tiny_encryption_algorithm.h File Reference

Go to the source code of this file.

Functions

uvec2 encrypt_tea (uvec2 arg)
 

Function Documentation

◆ encrypt_tea()

uvec2 encrypt_tea ( uvec2  arg)

Definition at line 20 of file tiny_encryption_algorithm.h.

21 {
22  const uint key[] = {
23  0xa341316c, 0xc8013ea4, 0xad90777d, 0x7e95761e
24  };
25  uint v0 = arg[0], v1 = arg[1];
26  uint sum = 0;
27  uint delta = 0x9e3779b9;
28 
29  #pragma unroll
30  for(int i = 0; i < 16; i++) {
31  //for(int i = 0; i < 32; i++) {
32  sum += delta;
33  v0 += ((v1 << 4) + key[0]) ^ (v1 + sum) ^ ((v1 >> 5) + key[1]);
34  v1 += ((v0 << 4) + key[2]) ^ (v0 + sum) ^ ((v0 >> 5) + key[3]);
35  }
36  return uvec2(v0, v1);
37 }
uint
uint32_t uint
Definition: global_ubo.h:233