Simple base32 encode/decode matching the base32 method used by Google Authenticator.
Features:
pub.dartlang.org: (you can use 'any' instead of a version if you just want the latest always)
dependencies:
base32: 1.0.0
import 'package:base32/base32.dart';
Start encoding/decoding ...
// Encode a hex string to base32
base32.encodeHexString('48656c6c6f21deadbeef'); // -> 'JBSWY3DPEHPK3PXP'
// base32 decoding to original string.
base32.decode("JBSWY3DPEHPK3PXP"); // -> '48656c6c6f21deadbeef'
base32.encode(List<int> byteList)
#Generate and return a RFC4122 v1 (timestamp-based) UUID.
byteList
- (List<int>
) A list of bytes representing your input.Returns String
representation of the encoded base32.
base32.encodeHexString(String hex)
#Generate and return a RFC4122 v4 UUID.
hexString
- (String
) A string of hex values intended to be converted to bytes and encoded.Returns String
representation of the encoded base32
Example: Encode a hex string.
base32.encodeHexString('48656c6c6f21deadbeef'); // -> 'JBSWY3DPEHPK3PXP'
base32.decode(String base32)
#Decodes a base32 string back to its original byte values.
base32
- (String
) The base32 string you wish to decode.Returns Uint8List
of the decoded data.
Example: Decode a base32 string, then output it in hex format
var decoded = base32.decode("JBSWY3DPEHPK3PXP");
var decodedHex = CryptoUtils.bytesToHex(decoded); // -> '48656c6c6f21deadbeef'
In dartvm
dart test\base32_test.dart
In Browser
At the moment, this package does not work client-side as it uses server-side only UInt8Lists. I might have to wait till UInt8Arrays and UInt8Lists are merged into 1
v1.0.0
v0.1.2
v0.1.0 & v0.1.1wq
v0.0.8
v0.0.7
v0.0.6
v0.0.5
v0.0.4
v0.0.3
v0.0.2
v0.0.1
v1.0.1
v1.0.0
v0.1.2
v0.1.0 & v0.1.1wq
v0.0.8
v0.0.7
v0.0.6
v0.0.5
v0.0.4
v0.0.3
v0.0.2
v0.0.1
example/example.dart
import 'package:base32/base32.dart';
void main() {
// Encode a hex string to base32
base32.encodeHexString('48656c6c6f21deadbeef'); // -> 'JBSWY3DPEHPK3PXP'
// base32 decoding to original string.
base32.decode("JBSWY3DPEHPK3PXP"); // -> '48656c6c6f21deadbeef'
}
Add this to your package's pubspec.yaml file:
dependencies:
base32: ^1.0.1
You can install packages from the command line:
with pub:
$ pub get
with Flutter:
$ flutter packages get
Alternatively, your editor might support pub get
or flutter packages get
.
Check the docs for your editor to learn more.
Now in your Dart code, you can use:
import 'package:base32/base32.dart';
Version | Uploaded | Documentation | Archive |
---|---|---|---|
1.0.1 | Aug 7, 2018 |
|
|
1.0.0+1 | Apr 10, 2018 |
|
|
1.0.0 | Apr 10, 2018 |
|
|
0.1.2 | Jan 31, 2015 |
|
|
0.1.1 | Nov 9, 2013 |
|
|
0.1.0 | Nov 9, 2013 |
|
|
0.0.8 | Sep 14, 2013 |
|
|
0.0.7 | May 27, 2013 |
|
|
0.0.6 | Apr 11, 2013 |
|
|
0.0.5 | Mar 3, 2013 |
|
|
Popularity:
Describes how popular the package is relative to other packages.
[more]
|
66
|
Health:
Code health derived from static analysis.
[more]
|
100
|
Maintenance:
Reflects how tidy and up-to-date the package is.
[more]
|
100
|
Overall:
Weighted score of the above.
[more]
|
83
|
We analyzed this package on Feb 14, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:
Detected platforms: Flutter, web, other
No platform restriction found in primary library
package:base32/base32.dart
.