       uLength     = Math.ceil(binary.length/8)
       unsignedInt = new Uint8Array(uLength)
       for i in [0..uLength]
-        uint8          = binary.slice(i*8, i*8 + 7)
-        unsignedInt[i] = Number.parseInt(uint8, 2)
+        uint8          = binary.subarray(i*8, i*8 + 7)
+        unsignedInt[i] = parseInt(uint8, 2) # Note: this shit is broken. Should probably hard-code constants.
       return unsignedInt
 
   return RsaKeyGenerator

          return keyPair
        )

    # Forge
    

    # Generate public and private RSA keys

    generate: (params) ->
      if window.crypto?.subtle?
        return @webCryptoGenerate(params)
      else if window.msCrypto?.subtle?
        return @ieWebCryptoGenerate(params)
      else
        return @forgeGenerate(params)

