<commit_before>'use strict';
var crypto = require('crypto');
var fs = require('fs');
var http = require('http');

var pkg = require('../package.json');

var utils = {};

utils.md5sum = function(data) {
  var md5 = crypto.createHash('md5');
  md5.update(data, 'utf8');
  return md5.digest('hex');
};

utils.md5sumFile = function(location, callback) {
  var md5 = crypto.createHash('md5');
  var rs = fs.createReadStream(location);
  rs.on('data', function(d) {
    md5.update(d);
  });
  rs.on('end', function() {
    return callback(null, md5.digest('hex'));
  });
};

utils.makeSign = function(method, uri, date, length, password, operator){
  if(uri.indexOf('?') >= 0) {
    uri = uri.split('?')[0];
  }
  var sign = method + '&' + uri + '&' + date + '&' + length + '&' + utils.md5sum(password);
  console.log(utils.md5sum('PUT&/travis/test/中文.md&Tue, 30 Dec 2014 04:01:41 GMT&573&05a671c66aefea124cc08b76ea6d30bb'));
  return 'UpYun ' + operator + ':' + utils.md5sum(sign);
};

utils.transEndpoint = function(endpoint) {
  switch((endpoint ? endpoint : '').toLowerCase()) {
    case 'v0':
      return 'v0.api.upyun.com';
    case 'v1':
    case 'ctcc':
      return 'v1.api.upyun.com';
    case 'v2':
    case 'cucc':
      return 'v2.api.upyun.com';
    case 'v3':
    case 'cmcc':
      return 'v3.api.upyun.com';
    default:
      return 'v0.api.upyun.com';<commit_msg>remove console<commit_after>'use strict';
var crypto = require('crypto');
var fs = require('fs');
var http = require('http');

var pkg = require('../package.json');

var utils = {};

utils.md5sum = function(data) {
  var md5 = crypto.createHash('md5');
  md5.update(data, 'utf8');
  return md5.digest('hex');
};

utils.md5sumFile = function(location, callback) {
  var md5 = crypto.createHash('md5');
  var rs = fs.createReadStream(location);
  rs.on('data', function(d) {
    md5.update(d);
  });
  rs.on('end', function() {
    return callback(null, md5.digest('hex'));
  });
};

utils.makeSign = function(method, uri, date, length, password, operator){
  if(uri.indexOf('?') >= 0) {
    uri = uri.split('?')[0];
  }
  var sign = method + '&' + uri + '&' + date + '&' + length + '&' + utils.md5sum(password);
  return 'UpYun ' + operator + ':' + utils.md5sum(sign);
};

utils.transEndpoint = function(endpoint) {
  switch((endpoint ? endpoint : '').toLowerCase()) {
    case 'v0':
      return 'v0.api.upyun.com';
    case 'v1':
    case 'ctcc':
      return 'v1.api.upyun.com';
    case 'v2':
    case 'cucc':
      return 'v2.api.upyun.com';
    case 'v3':
    case 'cmcc':
      return 'v3.api.upyun.com';
    default:
      return 'v0.api.upyun.com';
{'fraction_non_alphanumeric': 0.20508925180402582, 'fraction_numerical': 0.030763387770603876, 'mean_word_length': 3.479591836734694, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3336402', 'n_tokens_mistral': 1027, 'n_tokens_neox': 1006, 'n_words': 194}