From f9d4c28952ebb22e7d9de74c979159a40af4dc7f Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Mon, 1 Aug 2016 10:22:17 -0400 Subject: [PATCH] warn raspberry pi (ARM) users of slowness --- node.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/node.js b/node.js index fe6de54..7827f75 100644 --- a/node.js +++ b/node.js @@ -43,6 +43,23 @@ function create(deps) { }; RSA.generateKeypair = function (length, exponent, options, cb) { + if (!RSA._URSA && /arm|mips/i.test(require('os').arch) && !RSA._SLOW_WARN) { + console.warn("================================================================"); + console.warn(" WARNING"); + console.warn("================================================================"); + console.warn(""); + console.warn("WARNING: You are generating an RSA key using pure JavaScript on"); + console.warn(" a VERY SLOW cpu. This could take DOZENS of minutes!"); + console.warn(""); + console.warn(" We recommend installing a C compiler and 'ursa'"); + console.warn(""); + console.warn("EXAMPLE:"); + console.warn(""); + console.warn(" sudo apt-get install build-essential && npm install ursa"); + console.warn(""); + console.warn("================================================================"); + RSA._SLOW_WARN = true; + } var keypair = { privateKeyPem: undefined , publicKeyPem: undefined