Catalog/encoding-rail-fence

Encoding

Rail-fence cipher API

Encodes/decodes the rail-fence (zigzag) transposition cipher for a given number of rails, correctly rebuilding the zigzag traversal on decode. Answers 'What is the 3-rail rail-fence of this text?', 'Decrypt this rail-fence ciphertext.'

Price$0.02per request
MethodPOST
Route/v1/encoding/rail-fence
StatusLive
MIME typeapplication/json
Rate limit120/minute
Cache0s public
rail-fencetranspositioncipherzigzagencodedecodeclassicalencoding
API URLhttps://x402.hexl.dev/v1/encoding/rail-fence
Integration docs
Example request
{
  "value": "WEAREDISCOVEREDFLEEATONCE",
  "rails": 3
}
Example response
{
  "operation": "encode",
  "rails": 3,
  "result": "WECRLTEERDSOEEFEAOCAIVDEN",
  "interpretation": "Rail-fence (3 rails) encoded 25 chars."
}
Input schema
{
  "type": "object",
  "required": [
    "value",
    "rails"
  ],
  "properties": {
    "value": {
      "type": "string",
      "examples": [
        "WEAREDISCOVEREDFLEEATONCE"
      ]
    },
    "rails": {
      "type": "number",
      "examples": [
        3
      ]
    },
    "operation": {
      "type": "string",
      "enum": [
        "encode",
        "decode"
      ]
    }
  }
}
Output schema
{
  "type": "object",
  "additionalProperties": true
}