func encryptCommand(key string, text string) string {
	textBytes := []byte(text)

	block, err := aes.NewCipher([]byte(base32.StdEncoding.EncodeToString([]byte(key))))
	if err != nil {
		log.Fatal(err)
	}

	// The IV needs to be unique, but not secure. Therefore it's common to
	// include it at the beginning of the ciphertext.
	ciphertext := make([]byte, aes.BlockSize+len(textBytes))
	iv := ciphertext[:aes.BlockSize]
	if _, err := io.ReadFull(rand.Reader, iv); err != nil {
		log.Fatal(err)
	}

	stream := cipher.NewCFBEncrypter(block, iv)
	stream.XORKeyStream(ciphertext[aes.BlockSize:], textBytes)

	// convert to base64
	return base64.URLEncoding.EncodeToString(ciphertext)
}
// encrypt string to base64 crypto using AES
encrypt string to base64 crypto using AES
// encrypt string to base64 crypto using AES
func encryptCommand(key string, text string) string {
	textBytes := []byte(text)
	block, err := aes.NewCipher([]byte(base32.StdEncoding.EncodeToString([]byte(key))))
	if err != nil {
		log.Fatal(err)
	}
	ciphertext := make([]byte, aes.BlockSize+len(textBytes))
	iv := ciphertext[:aes.BlockSize]
	if _, err := io.ReadFull(rand.Reader, iv); err != nil {
		log.Fatal(err)
	}
	stream := cipher.NewCFBEncrypter(block, iv)
	stream.XORKeyStream(ciphertext[aes.BlockSize:], textBytes)
	return base64.URLEncoding.EncodeToString(ciphertext)
}
func encryptCommand ( key string , text string ) string { textBytes := [ ] byte ( text ) block , err := aes . NewCipher ( [ ] byte ( base32 . StdEncoding . EncodeToString ( [ ] byte ( key ) ) ) ) if err != nil { log . Fatal ( err ) } ciphertext := make ( [ ] byte , aes . BlockSize + len ( textBytes ) ) iv := ciphertext [ : aes . BlockSize ] if _ , err := io . ReadFull ( rand . Reader , iv ) ; err != nil { log . Fatal ( err ) } stream := cipher . NewCFBEncrypter ( block , iv ) stream . XORKeyStream ( ciphertext [ aes . BlockSize : ] , textBytes ) return base64 . URLEncoding . EncodeToString ( ciphertext ) }
encrypt string to base64 crypto using AES
encrypt string to base64 crypto using AES
// The IV needs to be unique, but not secure. Therefore it's common to // include it at the beginning of the ciphertext. // convert to base64