_id
stringlengths
2
6
title
stringlengths
0
58
partition
stringclasses
3 values
text
stringlengths
27
233k
language
stringclasses
1 value
meta_information
dict
q13300
Logger
train
function Logger() { this._level = LEVELS.NOTICE; this._out = process.stdout; this._err = process.stderr; /* istanbul ignore next: allow server to suppress logs */
javascript
{ "resource": "" }
q13301
level
train
function level(lvl) { if(!lvl) return this._level; if(!~LEVELS.indexOf(lvl)) { throw new Error('invalid log
javascript
{ "resource": "" }
q13302
warning
train
function warning() { var args = [LEVELS.WARNING].concat(slice.apply(arguments));
javascript
{ "resource": "" }
q13303
notice
train
function notice() { var args = [LEVELS.NOTICE].concat(slice.apply(arguments));
javascript
{ "resource": "" }
q13304
verbose
train
function verbose() { var args = [LEVELS.VERBOSE].concat(slice.apply(arguments));
javascript
{ "resource": "" }
q13305
createConfiguration
train
function createConfiguration (options) { const cfg = Object.assign({ followSymbolicLinks: false, cacheTimeInSeconds : 0, documentRoot : process.cwd(), parsedURLName : 'urlParsed', getFilePath : getFilePath, getFileStats : getFileStats, getResponseData : getResponseData, stand...
javascript
{ "resource": "" }
q13306
getFileStats
train
function getFileStats (cfg, filePath, callback) { fs.realpath(filePath, function (err, realpath) { // On Windows we can get different cases for the same disk letter :/. let checkPath = realpath; if (os.platform() === 'win32' && realpath) { checkPath = realpath.toLowerCase();
javascript
{ "resource": "" }
q13307
getResponseDataWhole
train
function getResponseDataWhole (fileStats/* , headers*/) { return { body : fs.createReadStream(fileStats.path), statusCode: HTTP_CODES.OK, headers : { 'Content-Type' : mime(fileStats.path),
javascript
{ "resource": "" }
q13308
createFileResponseHandler
train
function createFileResponseHandler (options) { const cfg = createConfiguration(options); if (cfg instanceof Error) { return cfg; } /** * @private * @param {!external:"http.IncomingMessage"} req * @param {!external:"http.ServerResponse"} res * @param {Function} [callback] calle...
javascript
{ "resource": "" }
q13309
train
function(inputIndex) { _.each(tokens, function(token, index) { // determain whether or not this is a file reference or a string if(token.file) { // read the file and reset replacement to what was loaded fs.readFile(token.file, 'utf8',...
javascript
{ "resource": "" }
q13310
train
function(inputIndex) { var inputPath = input[inputIndex].split("/"); inputPath = inputPath[inputPath.length - 1]; var path = outputIsPath ? output + inputPath : output; // write the input string to the output file name grunt.log.writeln('Writing Output: ' + ...
javascript
{ "resource": "" }
q13311
string_component
train
function string_component(self, message, component) { eventify(self); valuable(self, update, ''); var $c = $$().addClass('control'); var $l = $("<label>" + message + "</label>"); var $i = $(component); $c.append($l, $i); self.$el =
javascript
{ "resource": "" }
q13312
attributable
train
function attributable(form, c, name) { if (form._vals == null) form._vals = {}; if (form._update == null) form._update = function () {
javascript
{ "resource": "" }
q13313
UserVoiceSSO
train
function UserVoiceSSO(subdomain, ssoKey) { // For UserVoice, the subdomain is used as password // and the ssoKey is used as salt this.subdomain = subdomain; this.ssoKey = ssoKey; if(!this.subdomain) { throw new
javascript
{ "resource": "" }
q13314
getDomain
train
function getDomain(data, accessor) { return data .map(function (item) { return accessor.call(this, item); })
javascript
{ "resource": "" }
q13315
validateRule
train
function validateRule(rule, value) { // For a given rule, get the first letter of the string name of its // constructor function. "R" -> RegExp, "F" -> Function (these shouldn't // conflict with any other types one might specify). Note: instead of // getting .toString from a new object {} or Object.prot...
javascript
{ "resource": "" }
q13316
Dotfile
train
function Dotfile(basename, options) { this.basename = basename; this.extname = '.json'; this.dirname = (options
javascript
{ "resource": "" }
q13317
transform
train
function transform(value) { if(typeof value === 'function') value = value() if(value instanceof Array) { var el = document.createDocumentFragment() value.map(item => el.appendChild(transform(item))) value = el } else if(typeof value === 'object') { if(typeof value.then === 'function') { var tmp = ...
javascript
{ "resource": "" }
q13318
Requests
train
function Requests(apiUrl, version, publicKey) { this.apiUrl =
javascript
{ "resource": "" }
q13319
train
function(id) { var file; if (typeof id === 'number') { file = this.uploader.files[id]; } else {
javascript
{ "resource": "" }
q13320
train
function(file) { if (plupload.typeOf(file) === 'string')
javascript
{ "resource": "" }
q13321
train
function(type, message) { var popup = $( '<div class="plupload_message">' + '<span class="plupload_message_close ui-icon ui-icon-circle-close" title="'+_('Close')+'"></span>' + '<p><span class="ui-icon"></span>' + message + '</p>' + '</div>' ); popup .addClass('ui-state-' + (type === 'erro...
javascript
{ "resource": "" }
q13322
train
function() { // destroy uploader instance this.uploader.destroy(); // unbind all button events $('.plupload_button', this.element).unbind(); // destroy buttons if ($.ui.button) { $('.plupload_add, .plupload_start, .plupload_stop', this.container) .button('destroy'); } // destroy progress...
javascript
{ "resource": "" }
q13323
measure
train
function measure() { if (!tw || !th) { var wrapper = $('.plupload_file:eq(0)', self.filelist); tw = wrapper.outerWidth(true); th = wrapper.outerHeight(true); } var aw =
javascript
{ "resource": "" }
q13324
obv
train
function obv (fn, immediate) { if(!fn) return state listeners.push(fn) if(immediate !== false && fn(state) === true) obv.more() return function () {
javascript
{ "resource": "" }
q13325
isValid
train
function isValid (type, value) { switch (type) { case 'email': return validator.isEmail(value); break; case 'url': return validator.isURL(value); break; case 'domain': return validator.isFQDN(value); break; case 'ip': ...
javascript
{ "resource": "" }
q13326
_buildNamespace
train
function _buildNamespace(appName, depth) { var callerFile; // Our default depth needs to be 2, since 1 is this file. Add the user // supplied depth to 1 (for this file) to make it 2. callerFile = caller(depth + 1); // if for some reason we're unable to determine the caller, use the appName only ...
javascript
{ "resource": "" }
q13327
logger
train
function logger(appName, options) { var namespace, log, error; options = options ? options : {}; // merge our default options with the user supplied options = xtend({ depth: 1, randomColors: false, logColor: 7, errorColor: 1, }, options); // get the filename wh...
javascript
{ "resource": "" }
q13328
init_session
train
function init_session(req) { debug.assert(req.session).is('object'); if(!is.obj(req.session.client)) { req.session.client = {}; } if( (!is.obj(req.session.client.messages))
javascript
{ "resource": "" }
q13329
train
function (baseUrl, firebaseUrl, port, cardsDirectory) { // Set environment variables. process.env.BASE_URL = baseUrl || ''; process.env.FIREBASE_URL = firebaseUrl || 'https://hashdodemo.firebaseio.com/', process.env.CARDS_DIRECTORY = cardsDirectory || process.cwd(); process.env.PORT = port || 4000; ...
javascript
{ "resource": "" }
q13330
train
function (callback) { var APIController = require('./controllers/api'), DefaultController = require('./controllers/index'), PackController = require('./controllers/pack'), CardController = require('./controllers/card'), WebHookController = require('./controllers/webhook'), ProxyControl...
javascript
{ "resource": "" }
q13331
run
train
function run(files, options) { // If translations or templates are not supplied then error if (options.translations.length === 0) { grunt.fail.fatal('Please supply translations'); } // If a missing translation regex has been supplied report the missing count if (opti...
javascript
{ "resource": "" }
q13332
logError
train
function logError(e) { e = e instanceof Error ? e : e ? new Error(e) : null; if (e) { if (options && util.isRegExp(options.hideTokenRegExp)) { e.message = e.message.replace(options.hideTokenRegExp, function(match, prefix, token, suffix) { return
javascript
{ "resource": "" }
q13333
loadFile
train
function loadFile(name, dir, options) { var pathname = path.normalize(path.join(options.prefix, name)); var obj = {}; var filename = (obj.path = path.join(dir, name)); var stats = fs.statSync(filename); var buffer = fs.readFileSync(filename); obj.cacheControl = options.cacheControl; obj.maxAge = obj.maxA...
javascript
{ "resource": "" }
q13334
on
train
function on(name, hdl) { var list = eventHandlers[name] || (eventHandlers[name] = []);
javascript
{ "resource": "" }
q13335
train
function(string){ var pattern = /(^|\W)(\w)(\w*)/g, result = [], match; while (pattern.exec(string)) { result.push(RegExp.$1
javascript
{ "resource": "" }
q13336
train
function(module) { for (var i = 0; i < module.include.length; i++) { var curInclude = module.include[i]; if (curInclude.substr(0, 2) == '^!') {
javascript
{ "resource": "" }
q13337
train
function(customEvent, callback, context, filter, prepend) {
javascript
{ "resource": "" }
q13338
train
function(customEvent, callback, context, filter, prepend) {
javascript
{ "resource": "" }
q13339
train
function (emitterName) { var instance = this, pattern; if (emitterName) { pattern = new RegExp('^'+emitterName+':'); instance._ce.itsa_each( function(value, key) { key.match(pattern) && (delete instance._...
javascript
{ "resource": "" }
q13340
train
function (e, checkFilter, before, preProcessor, subscribers) { // subscribers, plural var subs, passesThis, passesFilter; if (subscribers && !e.status.halted && !e.silent) { subs = before ? subscribers.b : subscribers.a; subs && subs.some(function(subscriber) { ...
javascript
{ "resource": "" }
q13341
askForGithubAuth
train
function askForGithubAuth (options, cb) { if (typeof options === 'function') { cb = options; options = {}; } options = options || {}; options.store = options.store || 'default'; if (typeof options.store === 'string') { options.store = 'for-github-auth.' + options.store; } loadQuestions(options...
javascript
{ "resource": "" }
q13342
StripMQ
train
function StripMQ(input, options, formatOptions) { options || (options = {}); formatOptions || (formatOptions = {}); options = { type: options.type || 'screen', width: options.width || 1024, 'device-width': options['device-width'] || options.width || 1024, ...
javascript
{ "resource": "" }
q13343
parseSpans
train
function parseSpans(text) { var links = parseLinks(text); /*Represented as [{ href: "http://yada", start: startIndex, end: endIndex }]*/ var spans = []; var lastSpan = null; function isPrefixedLinkSpan(span) { return span && "href" in span && span.prefix && "proposed" in span.pr...
javascript
{ "resource": "" }
q13344
makeFuncAsciiDomainReplace
train
function makeFuncAsciiDomainReplace(ctx) { return function (asciiDomain) { var asciiStartPosition = ctx.domain.indexOf(asciiDomain, ctx.asciiEndPosition); ctx.asciiEndPosition = asciiStartPosition + asciiDomain.length;
javascript
{ "resource": "" }
q13345
train
function(stdout, next) { var lines = stdout.split("\n"); var filenames = _.transform(lines, function(result, line) { var status = line.slice(0, 2); if
javascript
{ "resource": "" }
q13346
train
function(filenames) { var isIn = _.some(filenames, function(line) {
javascript
{ "resource": "" }
q13347
Message
train
function Message(rawText){ this.rawText = rawText; this._parsed = false; this._isFetch = false; this._isNoop = false; this._list =
javascript
{ "resource": "" }
q13348
train
function () { if (this._lock) return this._lock = true let task = this._tasks.shift() let tstType = this.error ? ['catch', 'end'] : ['then', 'end'] while (task && !~tstType.indexOf(task.type)) { task = this._tasks.shift() } if (task) { let cb = (err, res) => { this.error ...
javascript
{ "resource": "" }
q13349
train
function(time) { var self = this; self.eventDetection.recordRelease(time); if (self.eventDetection.isLongPress()) { // this is a "long-press" - reset detection states and notify the "long-press" observers self.eventDetection.reset(); self._notifyObservers(self.onLongPressCallbackRegistry...
javascript
{ "resource": "" }
q13350
longWait
train
function longWait (message, timer, cb) { setTimeout(function () { console.log(message); cb("pang"); //always
javascript
{ "resource": "" }
q13351
resolveDeps
train
function resolveDeps (args) { return deps.map(function (dep) { if (args && args.length && typeof dep === 'number') { return args[dep];
javascript
{ "resource": "" }
q13352
getInst
train
function getInst (bind, args) { args = resolveDeps(args);
javascript
{ "resource": "" }
q13353
resolveInst
train
function resolveInst (bind, args) { return isTransient ? getInst(bind, args) :
javascript
{ "resource": "" }
q13354
init
train
function init (func) { func = ensureFunc(func); cache = undefined;
javascript
{ "resource": "" }
q13355
getItemDefinedGroups
train
function getItemDefinedGroups() { var groups = {}, itemName, item, itemToolbar, group, order; for ( itemName in editor.ui.items ) { item = editor.ui.items[ itemName ]; itemToolbar = item.toolbar || 'others'; if ( itemToolbar ) { // Break the toolbar property into its parts: "group_na...
javascript
{ "resource": "" }
q13356
train
function (query, page, callback) { var History = exports.get('History'); History.paginate(query, { page: page, limit: vulpejs.app.pagination.history, }, function (error, items, pageCount, itemCount) { if (error) { vulpejs.log.error('HISTORY', error); } else { callback(error, {
javascript
{ "resource": "" }
q13357
Request
train
function Request(server, keys, rejectable, config) { if (!config) config = {}; if (typeof config !== 'object') config = { path: config }; const promise = new Promise((resolve, reject) => { let fulfilled = false; this.on('res-complete', () => { if (fulfilled) { r...
javascript
{ "resource": "" }
q13358
Migrate
train
function Migrate (grunt, adapter, config, steps) { this.grunt = grunt; this.adapter = adapter; this.path
javascript
{ "resource": "" }
q13359
train
function(parent, protoProps, staticProps) { var child; // The constructor function for the new subclass is either defined by you // (the "constructor" property in your extend definition), or defaulted // by us to simply call the parent's constructor. if (protoProps && protoProps.hasOwnProperty('constructor')...
javascript
{ "resource": "" }
q13360
train
function (finder) { if (mongo_query_options && mongo_query_options.sort)
javascript
{ "resource": "" }
q13361
train
function( editor ) { var selection = editor.getSelection(); var selectedElement = selection.getSelectedElement(); if ( selectedElement && selectedElement.is( 'a' )
javascript
{ "resource": "" }
q13362
loadTemplate
train
function loadTemplate(template, name, callback) { async.waterfall([ cb => source(template.path, template.filter, template.readMode, cb), (files, cb) =>
javascript
{ "resource": "" }
q13363
Headers
train
function Headers (size, type, ttl, enc) { if (!(this instanceof Headers)) return new Headers(size, type, ttl, enc) if (size) this['Content-Length'] = size if (type) this['Content-Type']
javascript
{ "resource": "" }
q13364
train
function (next) { async.each(input, function (path, done) { fs.stat(path, function (err, stats) { if (err) return done(err); if (stats.isDirectory())
javascript
{ "resource": "" }
q13365
train
function( name ) { if ( ! munit.isString( name ) || ! name.length ) { throw new Error( "Name not found for removing formatter" ); } if ( render._formatHash[ name ] ) { delete
javascript
{ "resource": "" }
q13366
train
function( path, callback ) { var parts = ( path || '' ).split( /\//g ), filepath = '/'; // Trim Left if ( ! parts[ 0 ].length ) { parts.shift(); } // Trim right if ( parts.length && ! parts[ parts.length - 1 ].length ) { parts.pop(); } // Handle root '/' error if ( ! parts.length ) { re...
javascript
{ "resource": "" }
q13367
train
function( path, callback ) { var match = munit.isRegExp( render.options.file_match ) ? render.options.file_match : rtestfile; path += '/'; fs.readdir( path, function( e, files ) { if ( e ) { return callback( e ); } async.each( files || [], function( file, callback ) { var fullpath = path +...
javascript
{ "resource": "" }
q13368
train
function( nspath ) { var found = true, nsparts = nspath.split( rpathsplit ), focus = render.options.focus; // Allow single path string if ( munit.isString( focus ) ) { focus = [ focus ]; } // If set, only add modules that belong on the focus path(s) if ( munit.isArray( focus ) && focus.length ) {...
javascript
{ "resource": "" }
q13369
train
function( required, startFunc ) { if ( required !== render.state ) {
javascript
{ "resource": "" }
q13370
train
function( ns ) { munit.each( ns, function( assert, name ) { if ( render.focusPath( assert.nsPath ) ) { munit.tests.push( assert ); } else { assert.trigger();
javascript
{ "resource": "" }
q13371
train
function( assert ) { var stack = [], depends, i, l, module; // Should only be checking dependencies when in compile mode render.requireMinState( munit.RENDER_STATE_COMPILE, render.checkDepency ); // Build up the list of dependency paths do { depends = assert.option( 'depends' ); // Allow single path ...
javascript
{ "resource": "" }
q13372
train
function(){ var options = render.options, path = options.render = render._normalizePath( options.render ); // Ensure render path actually exists fs.stat( path, function( e, stat ) { if ( e || ! stat || ! stat.isDirectory() ) { return munit.exit( 1, e, "'" + path + "' is not a directory" ); } // ...
javascript
{ "resource": "" }
q13373
train
function(){ // Swap render state to compile mode for priority generation render.requireState( munit.RENDER_STATE_READ, render._compile ); render.state = munit.RENDER_STATE_COMPILE; render._renderNS( munit.ns ); // Just in case triggers set off any undesired state render.requireState( munit.RENDER_STATE_COM...
javascript
{ "resource": "" }
q13374
train
function(){ var color = munit.color.get[ munit.failed > 0 ? 'red' : 'green' ], callback = render.callback; // Can only complete a finished munit state // (dont pass startFunc, we want _complete as part of the trace here) render.requireState( munit.RENDER_STATE_FINISHED ); render.state = munit.RENDER_STATE...
javascript
{ "resource": "" }
q13375
train
function( dir ) { // Make the root results directory first render._mkdir( dir, function( e ) { if ( e ) { return munit.exit( 1, e, "Failed to make root results directory" ); } // Make a working directory for each format async.each( render._formats, function( format, callback ) { var path =...
javascript
{ "resource": "" }
q13376
train
function(){ var finished = true, now = Date.now(), options = render.options, results = options.results ? render._normalizePath( options.results ) : null; // Wait until all modules have been triggered before checking states if ( render.state < munit.RENDER_STATE_ACTIVE ) { return; } // Can only c...
javascript
{ "resource": "" }
q13377
train
function(api, id, key, data) { // get storage object var obj = _getStorageObject(api, id); if(obj === null) { // create a new storage object obj =
javascript
{ "resource": "" }
q13378
train
function(api, id, key) { // get storage object var rval = _getStorageObject(api, id); if(rval !== null) { // return data at key
javascript
{ "resource": "" }
q13379
train
function(api, id, key) { // get storage object var obj = _getStorageObject(api, id); if(obj !== null && key in obj) { // remove key delete obj[key]; // see if entry has no keys remaining var empty = true; for(var prop in obj) { empty = false;
javascript
{ "resource": "" }
q13380
train
function(func, args, location) { var rval = null; // default storage types if(typeof(location) === 'undefined') { location = ['web', 'flash']; } // apply storage types in order of preference var type; var done = false; var exception = null; for(var idx in location) { type = location[idx]; ...
javascript
{ "resource": "" }
q13381
train
function(b) { var b2 = b.getByte(); if(b2 === 0x80) { return undefined; } // see if the length is "short form" or "long form" (bit 8 set) var length; var longForm = b2 & 0x80; if(!longForm) { // length is just the first byte length = b2; } else { // the number of
javascript
{ "resource": "" }
q13382
_reseedSync
train
function _reseedSync() { if(ctx.pools[0].messageLength >= 32) { return _seed(); }
javascript
{ "resource": "" }
q13383
_seed
train
function _seed() { // create a plugin-based message digest var md = ctx.plugin.md.create(); // digest pool 0's entropy and restart it md.update(ctx.pools[0].digest().getBytes()); ctx.pools[0].start(); // digest the entropy of other pools whose index k meet the // condition '2^k mod n == 0'...
javascript
{ "resource": "" }
q13384
defaultSeedFile
train
function defaultSeedFile(needed) { // use window.crypto.getRandomValues strong source of entropy if available var getRandomValues = null; if(typeof window !== 'undefined') { var _crypto = window.crypto || window.msCrypto; if(_crypto && _crypto.getRandomValues) { getRandomValues = functio...
javascript
{ "resource": "" }
q13385
spawnPrng
train
function spawnPrng() { var ctx = forge.prng.create(prng_aes); /** * Gets random bytes. If a native secure crypto API is unavailable, this * method tries to make the bytes more unpredictable by drawing from data that * can be collected from the user of the browser, eg: mouse movement. * * If a callba...
javascript
{ "resource": "" }
q13386
train
function(plan) { var R = []; /* Get data from input buffer and fill the four words into R */ for(i = 0; i < 4; i ++) { var val = _input.getInt16Le(); if(_iv !== null) { if(encrypt) { /* We're encrypting, apply the IV first. */ val ^= _iv.getInt16Le(); } else...
javascript
{ "resource": "" }
q13387
train
function(input) { if(!_finish) { // not finishing, so fill the input buffer with more input _input.putBuffer(input); } while(_input.length() >= 8) { runPlan([ [ 5, mixRound ],
javascript
{ "resource": "" }
q13388
train
function(pad) { var rval = true; if(encrypt) { if(pad) { rval = pad(8, _input, !encrypt); } else { // add PKCS#7 padding to block (each pad byte is the // value of the number of pad bytes) var padding = (_input.length() === 8) ? 8 : (8 - _input.length...
javascript
{ "resource": "" }
q13389
bnGetPrng
train
function bnGetPrng() { // create prng with api that matches BigInteger secure random return { // x is an array to fill with bytes nextBytes: function(x) {
javascript
{ "resource": "" }
q13390
getPrime
train
function getPrime(bits, callback) { // TODO: consider optimizing by starting workers outside getPrime() ... // note that in order to clean up they will have to be made internally // asynchronous which may actually be slower // start workers immediately var workers = []; for(var i = 0; i < numWo...
javascript
{ "resource": "" }
q13391
_bnToBytes
train
function _bnToBytes(b) { // prepend 0x00 if first byte >= 0x80 var hex = b.toString(16); if(hex[0] >= '8') {
javascript
{ "resource": "" }
q13392
evpBytesToKey
train
function evpBytesToKey(password, salt, dkLen) { var digests = [md5(password + salt)]; for(var length =
javascript
{ "resource": "" }
q13393
_extensionsToAsn1
train
function _extensionsToAsn1(exts) { // create top-level extension container var rval = asn1.create(asn1.Class.CONTEXT_SPECIFIC, 3, true, []); // create extension sequence (stores a sequence for each extension) var seq = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, []); rval.value.push(seq); ...
javascript
{ "resource": "" }
q13394
_CRIAttributesToAsn1
train
function _CRIAttributesToAsn1(csr) { // create an empty context-specific container var rval = asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, []); // no attributes, return empty container if(csr.attributes.length === 0) { return rval; } // each attribute has a sequence with a type and a set of value...
javascript
{ "resource": "" }
q13395
train
function(filter) { var rval = {}; var localKeyId; if('localKeyId' in filter) { localKeyId = filter.localKeyId; } else if('localKeyIdHex' in filter) { localKeyId = forge.util.hexToBytes(filter.localKeyIdHex); } // filter on bagType only if(localKeyId === undefi...
javascript
{ "resource": "" }
q13396
train
function(secret, label, seed, length) { var rval = forge.util.createBuffer(); /* For TLS 1.0, the secret is split in half, into two secrets of equal length. If the secret has an odd length then the last byte of the first half will be the same as the first byte of the second. The length of the two secre...
javascript
{ "resource": "" }
q13397
train
function(key, seqNum, record) { /* MAC is computed like so: HMAC_hash( key, seqNum + TLSCompressed.type + TLSCompressed.version + TLSCompressed.length + TLSCompressed.fragment) */ var hmac = forge.hmac.create(); hmac.start('SHA1', key); var b = forge.util.createBuffer(); b.putI...
javascript
{ "resource": "" }
q13398
encrypt_aes_cbc_sha1
train
function encrypt_aes_cbc_sha1(record, s) { var rval = false; // append MAC to fragment, update sequence number var mac = s.macFunction(s.macKey, s.sequenceNumber, record); record.fragment.putBytes(mac); s.updateSequenceNumber(); // TLS 1.1+ use an explicit IV every time to protect against CBC attacks va...
javascript
{ "resource": "" }
q13399
decrypt_aes_cbc_sha1_padding
train
function decrypt_aes_cbc_sha1_padding(blockSize, output, decrypt) { var rval = true; if(decrypt) { /* The last byte in the output specifies the number of padding bytes not including itself. Each of the padding bytes has the same value as that last byte (known as the padding_length). Here we check al...
javascript
{ "resource": "" }