mirror of
				https://github.com/PurpleI2P/i2pd.git
				synced 2025-11-04 08:30:46 +00:00 
			
		
		
		
	encode with highY
This commit is contained in:
		
							parent
							
								
									36eaaa748c
								
							
						
					
					
						commit
						9ed58e5186
					
				
					 3 changed files with 22 additions and 6 deletions
				
			
		| 
						 | 
				
			
			@ -16,6 +16,12 @@ const uint8_t encoded_key[32] =
 | 
			
		|||
	0xef, 0x3a, 0xe4, 0x55, 0x33, 0xcd, 0x41, 0x0a, 0xa9, 0x1a, 0x41, 0x53, 0x31, 0xd8, 0x61, 0x2d
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
const uint8_t encoded_key_high_y[32] = 
 | 
			
		||||
{
 | 
			
		||||
	0x3c, 0xfb, 0x87, 0xc4, 0x6c, 0x0b, 0x45, 0x75, 0xca, 0x81, 0x75, 0xe0, 0xed, 0x1c, 0x0a, 0xe9,
 | 
			
		||||
	0xda, 0xe7, 0x9d, 0xb7, 0x8d, 0xf8, 0x69, 0x97, 0xc4, 0x84, 0x7b, 0x9f, 0x20, 0xb2, 0x77, 0x18
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
const uint8_t encoded1[32] =
 | 
			
		||||
{
 | 
			
		||||
	0xe7, 0x35, 0x07, 0xd3, 0x8b, 0xae, 0x63, 0x99, 0x2b, 0x3f, 0x57, 0xaa, 0xc4, 0x8c, 0x0a, 0xbc,
 | 
			
		||||
| 
						 | 
				
			
			@ -56,10 +62,12 @@ int main ()
 | 
			
		|||
{
 | 
			
		||||
	uint8_t buf[32];
 | 
			
		||||
	i2p::crypto::Elligator2 el;
 | 
			
		||||
	// encoding test
 | 
			
		||||
	// encoding tests
 | 
			
		||||
	el.Encode (key, buf);
 | 
			
		||||
	assert(memcmp (buf, encoded_key, 32) == 0);
 | 
			
		||||
	// decoding test
 | 
			
		||||
	el.Encode (key, buf, true); // with highY
 | 
			
		||||
	assert(memcmp (buf, encoded_key_high_y, 32) == 0);
 | 
			
		||||
	// decoding tests
 | 
			
		||||
	el.Decode (encoded1, buf);
 | 
			
		||||
	assert(memcmp (buf, key1, 32) == 0);
 | 
			
		||||
	el.Decode (encoded2, buf);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue