> For the complete documentation index, see [llms.txt](https://sarpers-organization.gitbook.io/ctftricks/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sarpers-organization.gitbook.io/ctftricks/_chapter-intro-3/pgp/trick-0052.md).

# Extract PGP Passphrase Hash (gpg2john)

***

Use `gpg2john` on a PGP secret key file (often with a `.asc` extension) to extract the passphrase hash. Redirect the standard output to a file, commonly named `hash.txt`, which contains the hash in a format suitable for password cracking tools like John the Ripper or hashcat.

```bash
gpg2john tryhackme.asc > hash.txt
```

The `gpg2john` tool is part of the `john` package. The extracted hash is in a format compatible with hashcat, specifically using hash mode 13700, which is the mode for "OpenPGP Secret Key (ES)". To crack the hash using hashcat with a wordlist, the following command can be used:

```bash
hashcat -m 13700 hash.txt wordlist.txt
```
