Skip to content

Instantly share code, notes, and snippets.

@dmlap
Created January 9, 2015 16:37
Show Gist options
  • Save dmlap/205f2859c3ca041a8421 to your computer and use it in GitHub Desktop.
Save dmlap/205f2859c3ca041a8421 to your computer and use it in GitHub Desktop.
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),(f.pkcs7||(f.pkcs7={})).unpad=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
(function (global){
global.window.pkcs7 = {
unpad: _dereq_('./unpad')
};
}).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"./unpad":2}],2:[function(_dereq_,module,exports){
/*
* pkcs7.unpad
* https://github.com/brightcove/pkcs7
*
* Copyright (c) 2014 Brightcove
* Licensed under the apache2 license.
*/
'use strict';
/**
* Returns the subarray of a Uint8Array without PKCS#7 padding.
* @param padded {Uint8Array} unencrypted bytes that have been padded
* @return {Uint8Array} the unpadded bytes
* @see http://tools.ietf.org/html/rfc5652
*/
module.exports = function unpad(padded) {
return padded.subarray(0, padded.byteLength - padded[padded.byteLength - 1]);
};
},{}]},{},[1])
(1)
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment