| 
									
										
										
										
											2016-02-23 17:33:54 +01:00
										 |  |  | package crypto | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import ( | 
					
						
							|  |  |  | 	"crypto/cipher" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-20 20:55:45 +02:00
										 |  |  | 	"v2ray.com/core/common/crypto/internal" | 
					
						
							| 
									
										
										
										
											2016-02-23 17:33:54 +01:00
										 |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-07-26 21:21:22 +02:00
										 |  |  | // NewChaCha20Stream creates a new Chacha20 encryption/descryption stream based on give key and IV. | 
					
						
							|  |  |  | // Caller must ensure the length of key is 32 bytes, and length of IV is either 8 or 12 bytes. | 
					
						
							| 
									
										
										
										
											2016-07-23 13:04:44 +02:00
										 |  |  | func NewChaCha20Stream(key []byte, iv []byte) cipher.Stream { | 
					
						
							| 
									
										
										
										
											2016-07-25 10:28:11 +02:00
										 |  |  | 	return internal.NewChaCha20Stream(key, iv, 20) | 
					
						
							| 
									
										
										
										
											2016-02-23 17:33:54 +01:00
										 |  |  | } |