パスワード、キー生成

パスワード(英数字 12桁)

<html> <pre class='code' id='PassStr'></pre> <button type=“button” onClick='GenerateStr(“PassStr”)'>再生成</button>

<script type=“text/javascript”>

GenerateStr("PassStr") ;
function GenerateStr(type) {
  document.getElementById(type).innerHTML = "" ;
  for(y = 0 ; y < 8 ; ++ y) {
    str = "" ;
    for(x = 0 ; x < 5 ; ++ x) {
      for(j = 0 ; j < 12 ; ++ j) {
        if(type == "PassMark" && Math.floor(Math.random() * 100) < 30) {
          r = Math.floor(Math.random() * (30)) ;
        mark = "`~!@#$\%^&*()_-+={}[]\\|:;\"',.?/" ;
          str += mark.substr(r,1) ;
        }
        else {
          r = Math.floor(Math.random() * (26 + 26 + 10)) ;
          if(r < 26)      str += String.fromCharCode(0x41 + r) ;
          else if(r < 52) str += String.fromCharCode(0x61 + r - 26) ;
          else if(r < 62) str += String.fromCharCode(0x30 + r - 52) ;
        }
      }
      if(x < 4) str += "  " ;
    }
    document.getElementById(type).innerHTML += str + "</br>" ;
  }
}

</script> </html>

パスワード(英数字と記号 12桁)

<html> <pre class='code' id='PassMark'></pre> <button type=“button” onClick='GenerateStr(“PassMark”)'>再生成</button>

<script type=“text/javascript”>

GenerateStr("PassMark") ;
function GenerateStr(type) {
  document.getElementById(type).innerHTML = "" ;
  for(y = 0 ; y < 8 ; ++ y) {
    str = "" ;
    for(x = 0 ; x < 5 ; ++ x) {
      for(j = 0 ; j < 12 ; ++ j) {
        if(type == "PassMark" && Math.floor(Math.random() * 100) < 30) {
          r = Math.floor(Math.random() * (30)) ;
        mark = "`~!@#$\%^&*()_-+={}[]\\|:;\"',.?/" ;
          str += mark.substr(r,1) ;
        }
        else {
          r = Math.floor(Math.random() * (26 + 26 + 10)) ;
          if(r < 26)      str += String.fromCharCode(0x41 + r) ;
          else if(r < 52) str += String.fromCharCode(0x61 + r - 26) ;
          else if(r < 62) str += String.fromCharCode(0x30 + r - 52) ;
        }
      }
      if(x < 4) str += "  " ;
    }
    document.getElementById(type).innerHTML += str + "</br>" ;
  }
}

</script> </html>

バイナリ(16進数16桁)

<html> <pre class='code' id='PassBin'></pre> <button type=“button” onClick='GenerateBin16()'>再生成</button>

<script type=“text/javascript”>

GenerateBin16() ;
function GenerateBin16() {
  document.getElementById('PassBin').innerHTML = "" ;
  for(i = 0 ; i < 16 ; ++ i) {
    str = "" ;
    for(j = 0 ; j < 16 ; ++ j) {
      if(str.length) str += "," ;
      str += "0x" + ("0" + Math.floor(Math.random() * 255).toString(16)).substr(-2,2) ;
    }
    document.getElementById('PassBin').innerHTML += str + "</br>" ;
  }
}

</script> </html>