Ad
How To Encrypt Password While Saving In Database In Flutter-SQLite-Dart Application?
I'm developing a mobile application using Flutter, Dart and SQLite. It is just a Login page validation kind of project where I need to encrypt the password and user's personal details while inserting in the database. At least I want the password to be encrypted. How is it possible to achieve this?
Ad
Answer
I've used cryptographic hashing functions for Dart and it works fine for me.
The below code is what I used to hash the password.
import 'package:crypto/crypto.dart';
import 'dart:convert'; // for the utf8.encode method
void main() {
var bytes = utf8.encode("password"); // data being hashed
var digest = sha256.convert(bytes);
print("Digest as bytes: ${digest.bytes}");
print("Digest as hex string: $digest");
}
Ad
source: stackoverflow.com
Related Questions
- → How do you create a 12 or 24 mnemonics code for multiple cryptocurrencies (ETH, BTC and so on..)
- → Flutter: input text field don't work properly in a simple example..... where am I wrong?
- → Can I customize the code formatting of Dart code in Atom?
- → Is it possible to develop iOS apps with Flutter on a Linux virtual machine?
- → Display SnackBar in Flutter
- → JSON ObjectMapper in Flutter
- → Material flutter app source code
- → TabBarSelection No such method error
- → How do I set the animation color of a LinearProgressIndicator?
- → Add different routes/screens to Flutter app
- → Is there a way to get the size of an existing widget?
- → How to share a file using flutter
- → Is there an easy way to find particular text built from RichText in a Flutter test?
Ad