nl_tokens: Encode an OID . The first two number are encoded specially in the first octet then the rest are encoded as one octet per number unless the number exceeds 127 . If so it s encoded as several base - 127 octets with the high bit set to indicate continuation .
pl_tokens: function oidArray ( oid ) { var bytes , i , val ; // Enforce some minimum requirements on the OID. if ( oid . length < 2 ) { throw new Error ( "Minimum OID length is two." ) ; } else if ( oid [ 0 ] > 2 ) { throw new Error ( "Invalid OID" ) ; } else if ( oid [ 0 ] == 0 && oid [ 1 ] > 39 ) { throw new Error ( "Invalid OID" ) ; } else if ( oid [ 0 ] == 1 && oid [ 1 ] > 39 ) { throw new Error ( "Invalid OID" ) ; } else if ( oid [ 0 ] == 2 && oid [ 1 ] > 79 ) { throw new Error ( "Invalid OID" ) ; } // Calculate the first byte of the encoded OID according to the 'special' rule. bytes = [ 40 * oid [ 0 ] + oid [ 1 ] ] ; // For the rest of the OID, encode each number individually and add the // resulting bytes to the buffer. for ( i = 2 ; i < oid . length ; i ++ ) { val = oid [ i ] ; if ( val > 127 ) { bytes = bytes . concat ( oidInt ( val ) ) ; } else { <mask> . push ( val ) ; } } return bytes ; }