Cloud and security

Generate a random secret or ID

A strong random key for things like JWT secrets and API tokens, or a fresh UUID.

  1. A 64-character hex secret
    Terminal
    openssl rand -hex 32
  2. A base64 secret
    Terminal
    openssl rand -base64 32
  3. A UUID
    Terminal
    uuidgen
  1. A 64-character hex secret
    Terminal · Ubuntu / Debian
    openssl rand -hex 32
  2. A base64 secret
    Terminal · Ubuntu / Debian
    openssl rand -base64 32
  3. A UUID
    Terminal · Ubuntu / Debian
    cat /proc/sys/kernel/random/uuid
  1. A 64-character hex secret
    PowerShell
    $b = New-Object byte[] 32; [Security.Cryptography.RandomNumberGenerator]::Create().GetBytes($b)
    ($b | ForEach-Object { $_.ToString('x2') }) -join ''
  2. A base64 secret
    PowerShell
    $b = New-Object byte[] 32; [Security.Cryptography.RandomNumberGenerator]::Create().GetBytes($b)
    [Convert]::ToBase64String($b)
  3. A UUID
    PowerShell
    [guid]::NewGuid()