• Try to run as may test as possible to make sure SDK 2.21 for ESP8266 can be released.

    function buildKey() {
          var randomString = btoa(Math.random().toString(36).substr(2, 8)+
                              Math.random().toString(36).substr(2, 8));
          var toHash = randomString + '258EAFA5-E914-47DA-95CA-C5AB0DC85B11';
          return {
              source: randomString,
              hashed: btoa(require('crypto').SHA1(toHash))
          }
    }
    
    console.log(buildKey());
    {
        "source": "MXFwZDFiamFmM2Jyd2xsaA==",
        "hashed": ""
     }
    

    Shouldn't hashed has a non empty string?

  • Works for strings but not for arrays, created issue #1509

    >btoa("Hallo");
    ="SGFsbG8="
    >btoa([0,1,2,3,4,5,6,7,8,9]);
    =""
    
  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

function buildKey() from module 'ws' returns empty hashed

Posted by Avatar for MaBe @MaBe

Actions