lib/asn1ber.js
function oidInt(val) {
    var bytes = [];

    bytes.push(val % 128);
    val = parseInt(val / 128, 10);
    while (val > 127) {
        bytes.push(128 + val % 128);
        val = parseInt(val / 128, 10);
    }
    bytes.push(val + 128);
    return bytes.reverse();
}
function oidInt(val) {
    var bytes = [];

    bytes.push(val % 128);
    val = parseInt(val / 128, 10);
    while (val > 127) {
        bytes.push(128 + val % 128);
        val = parseInt(val / 128, 10);
    }
    bytes.push(val + 128);
    return bytes.reverse();
}
Get the encoded representation of a number in an OID. If the number is less than 128, pass it as it is. Otherwise return an array of base-128 digits, most significant first, with the high bit set on all octets except the last one. This encoding should be used for all number in an OID except the first two (.1.3) which are handled specially.