How to use the charenc.bin.stringToBytes function in charenc

To help you get started, we’ve selected a few charenc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github JedWatson / react-select / examples / dist / app.js View on Github external
md5 = function (message, options) {
    // Convert to byte array
    if (message.constructor == String)
      if (options && options.encoding === 'binary')
        message = bin.stringToBytes(message);
      else
        message = utf8.stringToBytes(message);
    else if (isBuffer(message))
      message = Array.prototype.slice.call(message, 0);
    else if (!Array.isArray(message))
      message = message.toString();
    // else, assume byte array already

    var m = crypt.bytesToWords(message),
        l = message.length * 8,
        a =  1732584193,
        b = -271733879,
        c = -1732584194,
        d =  271733878;

    // Swap endian
github pvorb / node-md5 / md5.js View on Github external
md5 = function (message, options) {
    // Convert to byte array
    if (message.constructor == String)
      if (options && options.encoding === 'binary')
        message = bin.stringToBytes(message);
      else
        message = utf8.stringToBytes(message);
    else if (isBuffer(message))
      message = Array.prototype.slice.call(message, 0);
    else if (!Array.isArray(message) && message.constructor !== Uint8Array)
      message = message.toString();
    // else, assume byte array already

    var m = crypt.bytesToWords(message),
        l = message.length * 8,
        a =  1732584193,
        b = -271733879,
        c = -1732584194,
        d =  271733878;

    // Swap endian
github codeforgeek / RESTful-api-using-nodejs / node_modules / MD5 / md5.js View on Github external
md5 = function (message, options) {
    // Convert to byte array
    if (message.constructor == String)
      if (options && options.encoding === 'binary')
        message = bin.stringToBytes(message);
      else
        message = utf8.stringToBytes(message);
    else if (typeof Buffer != 'undefined' &&
        typeof Buffer.isBuffer == 'function' && Buffer.isBuffer(message))
      message = Array.prototype.slice.call(message, 0);
    else if (!Array.isArray(message))
      message = message.toString();
    // else, assume byte array already

    var m = crypt.bytesToWords(message),
        l = message.length * 8,
        a =  1732584193,
        b = -271733879,
        c = -1732584194,
        d =  271733878;
github petrosagg / papagal / src / vendor / MD5 / index.js View on Github external
var r = require("crypt"), o = require("charenc").utf8, i = require("charenc").bin, s = function(e, t) {
            if (e.constructor == String) {
                if (t && t.encoding === "binary") {
                    e = i.stringToBytes(e);
                } else {
                    e = o.stringToBytes(e);
                }
            } else {
                if (typeof n != "undefined" && typeof n.isBuffer == "function" && n.isBuffer(e)) {
                    e = Array.prototype.slice.call(e, 0);
                } else {
                    if (!Array.isArray(e)) {
                        e = e.toString()
                    };
                }
            }
            for (var a = r.bytesToWords(e), u = 8 * e.length, l = 1732584193, c = -271733879, p = -1732584194, d = 271733878, h = 0; h < a.length; h++) {
                a[h] = 16711935 & (a[h] << 8 | a[h] >>> 24) | 4278255360 & (a[h] << 24 | a[h] >>> 8);
            }
            a[u >>> 5] |= 128 << u % 32;

charenc

character encoding utilities

BSD-3-Clause
Latest version published 8 years ago

Package Health Score

65 / 100
Full package analysis