unsigned long problem

I keep getting this error, despite the fact that I have declared the variable:

tea.cpp: In function `void encode(long int*, long int*)':
tea.cpp:59: error: `Ox9e377969' was not declared in this scope
tea.cpp: In function `void decode(long int*, long int*)':
tea.cpp:84: error: `Ox9e377969' was not declared in this scope


Here is the code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52

  #include <iostream>
  #include <cstdlib>
  #include <cmath>
  
  using namespace std;
  

  //declare functions
  void encode (long *v, long *k);
  void decode (long *v, long *k);


  int main()  { 

  long v[2];
  long k[4];

  //key setup
  k[0] = 0xF0F0F0F0;
  k[1] = 0x0F0F0F0F;
  k[2] = 0xFFFF0000;
  k[3] = 0x0000FFFF;

  //set up data
  v[0] = 0x457269;
  v[1] = 0x636B53;

  cout << "Original Message: " << v[0] << v[1] << endl;

  encode(v, k);
  decode(v, k);







  return 0;
}
//*************************encode*********************************************
//  Name:         encode
//  Description:  encodes message
//  Parameters:   long *v, long *k
//  Return:	  none
//******************************************************************************
  void encode (long *v, long *k)  {
  unsigned long y = v[0];
  unsigned long z = v[1];
  unsigned long	sum = 0;
  unsigned long delta = Ox9e377969;  
  unsigned long n = 32;

  while (n-->0) {
  	 sum += delta;
	 y += ((z << 4) + k[0]) ^ (z + sum) ^ ((z >> 5) + k[1]);
	 z += ((y << 4) + k[2]) ^ (y + sum) ^ ((y >> 5) + k[3]);
  }

  v[0] = y;
  v[1] = z;

  }

//*************************decode*********************************************
//  Name:         decode
//  Description:  decodes message
//  Parameters:   long *v, long *k
//  Return:	  none
//******************************************************************************
  void decode(long *v, long *k)  {
  unsigned long n = 32;
  unsigned long sum = 0;
  unsigned long y = v[0];
  unsigned long z = v[1];
  unsigned long delta = Ox9e377969; <------ HERE

  while (n-->0)  {
	z -= ((y << 4) + k[2]) ^ (y + sum) ^ (( y >> 5) + k[3]);
	y -= ((z << 4) + k[0]) ^ (z + sum) ^ (( z >> 5) + k[1]);
	sum -= delta;
  }

  v[0] = y;
  v[1] = z;

  }
Last edited on
> `Ox9e377969' was not declared in this scope

Make sure that the first character is the numeral zero.
DUH - How embarrassing. Thanks :)
Topic archived. No new replies allowed.