GithubHelp home page GithubHelp logo

sqlite-md5's Introduction

sqlite-md5

The MD5 SQLite extension library provides the following MD5 message-digest algorithm functions (loaded with .load libsqlitemd5.so):

  • GROUP_MD5
  • MD5
  • MD5_UTF16 - returns the md5 hash of an UTF-16 representation of a string
  • MD5FILE

Installation

% make
% make test
# make install

FreeBSD users can install sqlite-md5 from port (unofficial).

Usage examples

.load libsqlitemd5.so

create table t1(x);
insert into t1 values (1);
insert into t1 values (2);
insert into t1 values (3);
select hex(group_md5(x)) from t1;

select hex(md5(''));

select hex(md5_utf16('a'));

select hex(md5file('/tmp/somefile'));

You can enter a string in the console's encoding and use the MD5_UTF16 method to get the MD5 hash of the UTF-16 representation of the given string. The method does not depend on the database encoding.

% sqlite3 :memory:

sqlite> .load libsqlitemd5.so

sqlite> .shell echo -n a | md5
0cc175b9c0f1b6a831c399e269772661
sqlite> select hex(md5('a'));
0CC175B9C0F1B6A831C399E269772661

sqlite> .shell echo -n a | iconv -t utf16le | md5
4144e195f46de78a3623da7364d04f11

sqlite> pragma encoding;
UTF-8
sqlite> select hex(md5_utf16('a'));
4144E195F46DE78A3623DA7364D04F11

sqlite> pragma encoding = "UTF-16be";
sqlite> select hex(md5_utf16('a'));
4144E195F46DE78A3623DA7364D04F11

License

This code in Public Domain

Acknowledgements

The code is based heavily on the now deprecated MBG SQLite's md5 extension by Alexey Pechnikov [email protected].

sqlite-md5's People

Contributors

eduardomozart avatar moisseev avatar orkblutt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

sqlite-md5's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.