func AESDecrypt(data []byte, password string) ([]byte, error) {
	// strip magic sequence
	data = data[10:]
	if len(data) == 0 {
		return data, nil
	}

	passwordHash := hashPassword(password)
	block, err := aes.NewCipher(passwordHash)
	if err != nil {
		panic(err)
	}

	gcm, err := cipher.NewGCM(block)
	if err != nil {
		panic(err)
	}

	cipherSize := len(data) - gcm.NonceSize()
	ciphertext, nonce := data[:cipherSize], data[cipherSize:]
	plaintext, err := gcm.Open(nil, nonce, ciphertext, nil)
	if err != nil {
		return nil, err
	}

	log.Println("Wallet decrypted")
	return plaintext, nil
}
// AESDecrypt when given some ciphertext concatted nonce
// and a password, returns the AES plaintext
AESDecrypt when given some ciphertext concatted nonce
and a password, returns the AES plaintext
// AESDecrypt when given some ciphertext concatted nonce // and a password returns the AES plaintext
func AESDecrypt(data []byte, password string) ([]byte, error) {
	data = data[10:]
	if len(data) == 0 {
		return data, nil
	}
	passwordHash := hashPassword(password)
	block, err := aes.NewCipher(passwordHash)
	if err != nil {
		panic(err)
	}
	gcm, err := cipher.NewGCM(block)
	if err != nil {
		panic(err)
	}
	cipherSize := len(data) - gcm.NonceSize()
	ciphertext, nonce := data[:cipherSize], data[cipherSize:]
	plaintext, err := gcm.Open(nil, nonce, ciphertext, nil)
	if err != nil {
		return nil, err
	}
	log.Println("Wallet decrypted")
	return plaintext, nil
}
func AESDecrypt ( data [ ] byte , password string ) ( [ ] byte , error ) { data = data [ 10 : ] if len ( data ) == 0 { return data , nil } passwordHash := hashPassword ( password ) block , err := aes . NewCipher ( passwordHash ) if err != nil { panic ( err ) } gcm , err := cipher . NewGCM ( block ) if err != nil { panic ( err ) } cipherSize := len ( data ) - gcm . NonceSize ( ) ciphertext , nonce := data [ : cipherSize ] , data [ cipherSize : ] plaintext , err := gcm . Open ( nil , nonce , ciphertext , nil ) if err != nil { return nil , err } log . Println ( " " ) return plaintext , nil }
AESDecrypt when given some ciphertext concatted nonce
and a password, returns the AES plaintext
AESDecrypt when given some ciphertext concatted nonce and a password returns the AES plaintext
// strip magic sequence