88 * specific language governing permissions and limitations under the License.
99 */
1010var tracer = require ( "tracer" ) ,
11+ algorithm = "aes-256-ctr" ,
12+ password = "U6Jv]H[tf;mxE}6t*PQz?j474A7T@Vx%gcVJA#2cr2GNh96ve+" ,
1113 debugEnvironmentVar = process . env . DIGEXP_DEBUG || '' ,
1214 debugNames = debugEnvironmentVar . toUpperCase ( ) . split ( ',' ) ,
1315 debugFunctions = { } ;
@@ -31,6 +33,22 @@ function debugLogger(moduleName) {
3133 return debugFunctions [ moduleName ] ;
3234} ;
3335
36+ function encrypt ( text ) {
37+ var crypto = require ( 'crypto' ) ;
38+ var cipher = crypto . createCipher ( algorithm , password ) ;
39+ var crypted = cipher . update ( text , "utf8" , "hex" ) ;
40+ crypted += cipher . final ( "hex" ) ;
41+ return crypted ;
42+ }
43+
44+ function decrypt ( text ) {
45+ var crypto = require ( 'crypto' ) ;
46+ var decipher = crypto . createDecipher ( algorithm , password ) ;
47+ var dec = decipher . update ( text , "hex" , "utf8" ) ;
48+ dec += decipher . final ( "utf8" ) ;
49+ return dec ;
50+ }
51+
3452var getModified = function ( dirName , dateString , ignore , callback ) {
3553 // takes the name of the directory you want to find the modified and a string for a date that is the toLocaleString of a date object
3654 //
@@ -97,4 +115,6 @@ utils.copyProperties = function(a, b) {
97115} ;
98116
99117utils . debugLogger = debugLogger ;
118+ utils . encrypt = encrypt ;
119+ utils . decrypt = decrypt ;
100120
0 commit comments