1--- 2layout: "api" 3page_title: "/sys/tools - HTTP API" 4sidebar_title: "<code>/sys/tools</code>" 5sidebar_current: "api-http-system-tools" 6description: |- 7 This is the API documentation for a general set of crypto tools. 8--- 9 10# `/sys/tools` 11 12The `/sys/tools` endpoints are a general set of tools. 13 14## Generate Random Bytes 15 16This endpoint returns high-quality random bytes of the specified length. 17 18| Method | Path | 19| :--------------------------- | :--------------------- | 20| `POST` | `/sys/tools/random(/:bytes)` | 21 22### Parameters 23 24- `bytes` `(int: 32)` – Specifies the number of bytes to return. This value can 25 be specified either in the request body, or as a part of the URL. 26 27- `format` `(string: "base64")` – Specifies the output encoding. Valid options 28 are `hex` or `base64`. 29 30### Sample Payload 31 32```json 33{ 34 "format": "hex" 35} 36``` 37 38### Sample Request 39 40``` 41$ curl \ 42 --header "X-Vault-Token: ..." \ 43 --request POST \ 44 --data @payload.json \ 45 http://127.0.0.1:8200/v1/sys/tools/random/164 46``` 47 48### Sample Response 49 50```json 51{ 52 "data": { 53 "random_bytes": "dGhlIHF1aWNrIGJyb3duIGZveAo=" 54 } 55} 56``` 57 58## Hash Data 59 60This endpoint returns the cryptographic hash of given data using the specified 61algorithm. 62 63| Method | Path | 64| :--------------------------- | :--------------------- | 65| `POST` | `/sys/tools/hash(/:algorithm)` | 66 67### Parameters 68 69- `algorithm` `(string: "sha2-256")` – Specifies the hash algorithm to use. This 70 can also be specified as part of the URL. Currently-supported algorithms are: 71 72 - `sha2-224` 73 - `sha2-256` 74 - `sha2-384` 75 - `sha2-512` 76 77- `input` `(string: <required>)` – Specifies the **base64 encoded** input data. 78 79- `format` `(string: "hex")` – Specifies the output encoding. This can be either 80 `hex` or `base64`. 81 82### Sample Payload 83 84```json 85{ 86 "input": "adba32==" 87} 88``` 89 90### Sample Request 91 92``` 93$ curl \ 94 --header "X-Vault-Token: ..." \ 95 --request POST \ 96 --data @payload.json \ 97 http://127.0.0.1:8200/v1/sys/tools/hash/sha2-512 98``` 99 100### Sample Response 101 102```json 103{ 104 "data": { 105 "sum": "dGhlIHF1aWNrIGJyb3duIGZveAo=" 106 } 107} 108``` 109 110