You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
526 B
JavaScript
24 lines
526 B
JavaScript
8 years ago
|
define(function () {
|
||
|
var Email = {};
|
||
|
var patt = /./g;
|
||
|
var each = function (d) {
|
||
|
d = d || 1;
|
||
|
return function (c, i) {
|
||
|
return String.fromCharCode((c.charCodeAt(0) + d));
|
||
|
};
|
||
|
};
|
||
|
|
||
|
Email.makeScrambler = function (n) {
|
||
|
return {
|
||
|
encrypt: function (S) {
|
||
|
return S.replace(patt, each(n));
|
||
|
},
|
||
|
decrypt: function (S) {
|
||
|
return S.replace(patt, each(-n));
|
||
|
}
|
||
|
};
|
||
|
};
|
||
|
|
||
|
return Email;
|
||
|
});
|