Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var Encryption = function(key, options) {
- try {
- sjcl.random.startCollectors()
- } catch (e) {}
- try {
- df()
- } catch (e) {}
- this.key = key;
- this.options = options || {};
- if (typeof this.options.numberIgnoreNonNumeric === "undefined") {
- this.options.numberIgnoreNonNumeric = true
- }
- if (typeof this.options.cvcIgnoreFornumber !== "undefined") {
- delete this.options.cvcIgnoreFornumber
- }
- if (typeof this.options.fourDigitCvcForBins === "undefined") {
- this.options.fourDigitCvcForBins = "34,37"
- }
- if (typeof this.options.cvcLengthFornumber !== "undefined") {
- delete this.options.cvcLengthFornumber
- }
- if (typeof this.options.cvcIgnoreBins === "string") {
- var binsToIgnore = [];
- this.options.cvcIgnoreBins.replace(/\d+/g, function(m) {
- if (m.length > 0 && !isNaN(parseInt(m, 10))) {
- binsToIgnore.push(m)
- }
- return m
- });
- if (binsToIgnore.length > 0) {
- this.options.cvcIgnoreFornumber = new RegExp("^\\s*(" + binsToIgnore.join("|") + ")")
- }
- } else {
- if (typeof this.options.cvcIgnoreBins !== "undefined") {
- delete this.options.cvcIgnoreBins
- }
- }
- if (typeof this.options.fourDigitCvcForBins === "string") {
- var cvcGroups = [];
- this.options.fourDigitCvcForBins.replace(/\d+/g, function(m) {
- if (m.length > 0 && !isNaN(parseInt(m, 10))) {
- cvcGroups.push(m)
- }
- return m
- });
- if (cvcGroups.length > 0) {
- this.options.cvcLengthFornumber = {
- matcher: new RegExp("^\\s*(" + cvcGroups.join("|") + ")"),
- requiredLength: 4
- }
- }
- }
- delete this.options.fourDigitCvcForBins;
- evLog("initializeCount")
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement