Merge branch 'master' of https://github.com/TimStallard/CryptoAssist
This commit is contained in:
		@@ -26,10 +26,10 @@ module.exports =  {
 | 
				
			|||||||
    .map((num)=>((num%52)+52)%52)
 | 
					    .map((num)=>((num%52)+52)%52)
 | 
				
			||||||
    .map((num)=>{
 | 
					    .map((num)=>{
 | 
				
			||||||
      if(num < 26){
 | 
					      if(num < 26){
 | 
				
			||||||
        asciiOffset = 97;
 | 
					        var asciiOffset = 97;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      else{
 | 
					      else{
 | 
				
			||||||
        asciiOffset = 65 - 26;
 | 
					        var asciiOffset = 65 - 26;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      return num + asciiOffset;
 | 
					      return num + asciiOffset;
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -9,8 +9,8 @@ function getFactors(num){
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function coPrime(a, b){
 | 
					function coPrime(a, b){
 | 
				
			||||||
  aFactors = getFactors(a);
 | 
					  var aFactors = getFactors(a);
 | 
				
			||||||
  bFactors = getFactors(b);
 | 
					  var bFactors = getFactors(b);
 | 
				
			||||||
  var common = aFactors.filter((factor)=>(bFactors.indexOf(factor) > -1));
 | 
					  var common = aFactors.filter((factor)=>(bFactors.indexOf(factor) > -1));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return (common.length == 0);
 | 
					  return (common.length == 0);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -21,7 +21,7 @@ module.exports =  {
 | 
				
			|||||||
    return cipherText
 | 
					    return cipherText
 | 
				
			||||||
    .split("")
 | 
					    .split("")
 | 
				
			||||||
    .map(require("./util/toNum.js"))
 | 
					    .map(require("./util/toNum.js"))
 | 
				
			||||||
    .map((int, pos, ints)=>{
 | 
					    .map(function(int, pos, ints){
 | 
				
			||||||
      if(Number.isInteger(int)){
 | 
					      if(Number.isInteger(int)){
 | 
				
			||||||
        this.i++;
 | 
					        this.i++;
 | 
				
			||||||
        return (int + 26 - keyNums[this.i%key.length])%26;
 | 
					        return (int + 26 - keyNums[this.i%key.length])%26;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -24,7 +24,7 @@ module.exports =  {
 | 
				
			|||||||
    .map(function(int, pos, ints){
 | 
					    .map(function(int, pos, ints){
 | 
				
			||||||
      if(Number.isInteger(int)){
 | 
					      if(Number.isInteger(int)){
 | 
				
			||||||
        this.i++;
 | 
					        this.i++;
 | 
				
			||||||
        return val =  (int + keyNums[this.i % key.length]) % 26;
 | 
					        return (int + keyNums[this.i % key.length]) % 26;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      else{
 | 
					      else{
 | 
				
			||||||
        return int;
 | 
					        return int;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,7 +7,7 @@ module.exports = {
 | 
				
			|||||||
  },
 | 
					  },
 | 
				
			||||||
  number: function(input){
 | 
					  number: function(input){
 | 
				
			||||||
    if(isNaN(parseInt(input))){
 | 
					    if(isNaN(parseInt(input))){
 | 
				
			||||||
      throw "Invalid input type - should be a string.";
 | 
					      throw "Invalid input type - should be a number.";
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    return parseInt(input);
 | 
					    return parseInt(input);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user