This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
* Secure Hash Algorithm (SHA1) | |
* http://www.webtoolkit.info/ | |
* | |
**/ | |
function SHA1(msg) { | |
function rotate_left(n,s) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var signal = [1,0,0,1,1,1,0,0,1,1,0,0,1,0,0,1,1,1,0,0,1,1,0,0,1,0,0,1,1,1,0,0,1,1,0,0,1,0,0,1,1,1,0,0,1,1,0,0] | |
function fourier(signal) { | |
var len = signal.length; | |
var output = new Array(); | |
for (var k = 0; k < len; k++) { | |
var real = 0; | |
var imag = 0; | |
for (var n = 0; n < len; n++) { | |
real += signal[n] * Math.cos( - 2 * Math.PI * k * n / len); |