Generate MD4 Hash using Dart

Pointy Castle package

  1. Add pointycastle and hex packages to pubspec.yaml file:
dependencies:
  hex: ^0.2.0
  pointycastle: ^3.0.1
  1. Install packages from the command line:
pub get
  1. Generate MD4 hash:
import 'dart:convert';
import "package:hex/hex.dart";
import 'package:pointycastle/pointycastle.dart';

void main() {
  String text = 'Hello';
  var digestObject = Digest('MD4');
  var bytes = digestObject.process(utf8.encode(text));
  String digest = HEX.encode(bytes);

  print(digest);
}

Leave a Comment

Cancel reply

Your email address will not be published.