Magnet to Torrent: Through establishing an online Torrent client, adding magnet link content, and after the client obtains the magnet metadata, repackaging the metadata into a Torrent file to achieve the conversion process from magnet link to torrent.
Torrent to Magnet: By parsing the torrent file, obtaining the file's metadata, extracting the info field from the parsed metadata, and calculating its SHA-1 hash value, which becomes the infoHash, to achieve the conversion process from torrent to magnet link.