<commit_before>var assert = require('assert')
var convert = require('../').convert
var ECKey = require('../src/eckey').ECKey
var Message = require('../').Message

describe('Message', function() {
  var msg

  beforeEach(function() {
    msg = '<NAME>'
  })

  describe('verify', function() {
    var addr, sig, caddr, csig

    beforeEach(function() {
      addr = '16UwLL9Risc3QfPqBUvKofHmBQ7wMtjvM' // uncompressed
      caddr = '1PMycacnJaSqwwJqjawXBErnLsZ7RkXUAs' // compressed

      sig = convert.hexToBytes('1bc25ac0fb503abc9bad23f558742740fafaec1f52deaaf106b9759a5ce84c93921c4a669c5ec3dfeb7e2d7d177a2f49db407900874f6de2f701a4c16783776d8d')
      csig = convert.hexToBytes('1fc25ac0fb503abc9bad23f558742740fafaec1f52deaaf106b9759a5ce84c93921c4a669c5ec3dfeb7e2d7d177a2f49db407900874f6de2f701a4c16783776d8d')
    })

    it('can verify a signed message', function() {
      assert.ok(Message.verify(addr, sig, msg))
      assert.ok(Message.verify(caddr, csig, msg))
    })

    it('will fail for the wrong message', function() {
      assert.ok(!Message.verify(addr, sig, 'foobar'))
      assert.ok(!Message.verify(caddr, csig, 'foobar'))
    })

    it('will fail for the wrong public key', function() {
      assert.ok(!Message.verify('1MsHWS1BnwMc3tLE8G35UXsS58fKipzB7a', sig, msg))
      assert.ok(!Message.verify('1Q1pE5vPGEEMqRcVRMbtBK842Y6Pzo6nK9', csig, msg))
    })

    it('supports alternate network addresses', function() {
      var taddr = 'mxnQZKxSKjzaMgrdXzk35rif3u62TLDrg9'
      var tsig = convert.base64ToBytes('IGucnrTku3KLCCHUMwq9anawfrlN8RK1HWMN+10LhsHJeysBdWfj5ohJcS/+oqrlVFNvEgbgEeAQUL6r3sZwnj8=')

      assert.ok(Message.verify(taddr, tsig, msg))<commit_msg>Removes convert module usage<commit_after>var assert = require('assert')
var ECKey = require('../src/eckey').ECKey
var Message = require('../').Message

describe('Message', function() {
  var msg

  beforeEach(function() {
    msg = 'vires is numeris'
  })

  describe('verify', function() {
    var addr, sig, caddr, csig

    beforeEach(function() {
      addr = '16UwLL9Risc3QfPqBUvKofHmBQ7wMtjvM' // uncompressed
      caddr = '1PMycacnJaSqwwJqjawXBErnLsZ7RkXUAs' // compressed

      sig = new Buffer('1bc25ac0fb503abc9bad23f558742740fafaec1f52deaaf106b9759a5ce84c93921c4a669c5ec3dfeb7e2d7d177a2f49db407900874f6de2f701a4c16783776d8d', 'hex')
      csig = new Buffer('1fc25ac0fb503abc9bad23f558742740fafaec1f52deaaf106b9759a5ce84c93921c4a669c5ec3dfeb7e2d7d177a2f49db407900874f6de2f701a4c16783776d8d', 'hex')
    })

    it('can verify a signed message', function() {
      assert.ok(Message.verify(addr, sig, msg))
      assert.ok(Message.verify(caddr, csig, msg))
    })

    it('will fail for the wrong message', function() {
      assert.ok(!Message.verify(addr, sig, 'foobar'))
      assert.ok(!Message.verify(caddr, csig, 'foobar'))
    })

    it('will fail for the wrong public key', function() {
      assert.ok(!Message.verify('1MsHWS1BnwMc3tLE8G35UXsS58fKipzB7a', sig, msg))
      assert.ok(!Message.verify('1Q1pE5vPGEEMqRcVRMbtBK842Y6Pzo6nK9', csig, msg))
    })

    it('supports alternate network addresses', function() {
      var taddr = 'mxnQZKxSKjzaMgrdXzk35rif3u62TLDrg9'
      var tsig = new Buffer('IGucnrTku3KLCCHUMwq9anawfrlN8RK1HWMN+10LhsHJeysBdWfj5ohJcS/+oqrlVFNvEgbgEeAQUL6r3sZwnj8=', 'base64')

      assert.ok(Message.verify(taddr, tsig, msg))
{'fraction_non_alphanumeric': 0.1216176033303598, 'fraction_numerical': 0.1159678858162355, 'mean_word_length': 4.790017211703959, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2434007', 'n_tokens_mistral': 1606, 'n_tokens_neox': 1417, 'n_words': 187}