Net::SS...:Cipher(3)
π NAME π
okay so bestie, Net::SSH::Perl::Cipher β it's the base cipher class, plus a whole lil toolkit of utility methods. That's the vibe. That's the whole thing. Periodt. β¨
π¦ SYNOPSIS π¦
here's how you actually use it, no cap:
use Net::SSH::Perl::Cipher;
# Get list of supported cipher IDs.
my $supported = Net::SSH::Perl::Cipher::supported();
# Translate a cipher name into an ID.
my $id = Net::SSH::Perl::Cipher::id($name);
# Translate a cipher ID into a name.
my $name = Net::SSH::Perl::Cipher::name($id);
πΈ DESCRIPTION πΈ
so Net::SSH::Perl::Cipher is the base class for each of the encryption cipher classes, like it's the mother of the whole cipher family π«Ά. On top of that, it also defines a bunch of utility methods that you can call either as functions or as object methods. Versatile queen behavior honestly. π
β¨ UTILITY METHODS β¨
π
supported( [ protocol => $protocol, ] [ $ciph_id [, $server_supports ] ])
no arguments? it hands you a reference to an array of ciphers that Net::SSH::Perl supports. lowkey these are basically the ciphers that have working Net::SSH::Perl::Cipher:: implementations. if you want the SSH2 ciphers, pass 'protocol => 2' and boom, there's your list. π
with one argument, $ciph_id β returns a true value if that cipher is supported by Net::SSH::Perl, and false otherwise. simple. iconic.
with two arguments, $ciph_id and $server_supports β returns true if the cipher represented by $ciph_id is supported both by Net::SSH::Perl and by the sshd server. the list of ciphers the server supports lives in $server_supports, which is a bit mask that the server sends over during the session identification phase. iykyk. π«
you can call it either as a non-exported function, like:
my $i_support = Net::SSH::Perl::Cipher::supported();
or as an object method of a Net::SSH::Perl::Cipher object, or honestly an object of a subclass, we don't gatekeep:
if ($ciph->supported($server_supports)) {
print "Server supports cipher $ciph";
}
π id( [ $cipher_name ] )
translates a cipher name into a cipher ID. that's the whole job bestie. π
give it $cipher_name and it translates that name into the corresponding ID. if you call it as an object method, it takes the object's cipher class name and translates that into the ID instead. π¦
π name( [ $cipher_id ] )
the reverse situation β translates a cipher ID into a cipher name. π
give it $cipher_id and it translates that ID into the corresponding name. call it as an object method and it returns the object's cipher class name, stripped β so for example, if the object were of type Net::SSH::Perl::Cipher::IDEA, then name would return IDEA. not the whole long thing, just the cute short one. main character energy. β¨
π₯ CIPHER USAGE π₯
π Net::SSH::Perl::Cipher->new($cipher_name, $key)
instantiates a brand new cipher object of type $cipher_name with the key $key, and returns the cipher object β which will be blessed into the actual cipher subclass. π
heads up tho: if$cipher_nameis the special type'None'(meaning no encryption cipher, we're just vibing), then the object gets blessed directly into the base class instead, and any text you try to encrypt or decrypt just gets passed through without any change. no encryption, no nothing. just a vibe. π
π $cipher->encrypt($text)
encrypts $text and returns the encrypted string. slay. π₯
π§ $cipher->decrypt($text)
decrypts $text and returns the decrypted string. the reverse slay. πΈ
π CIPHER DEVELOPMENT π
okay if you're building your own cipher class, listen up, because classes implementing an encryption cipher must implement these three methods. no skipping, bestie, this is the assignment: π
$class->new($key)β given a key$key, this should construct a new cipher object and bless it into$class, presumably. that's the whole task. π«$cipher->encrypt($text)β given plain text$text, this should encrypt the text and return the encrypted string. β¨$cipher->decrypt($text)β given encrypted text$text, this should decrypt the text and return the decrypted string. π
π AUTHOR & COPYRIGHTS π
for all the author, copyright, and license tea, please see the Net::SSH::Perl manpage. that's where the receipts live. π§Ύ
and that's a wrap on the Net::SSH::Perl::Cipher(3) page, which came to you as part of the User Contributed Perl Documentation β¨ β this version is perl v5.42.0, dated 2026-01-17, so if you're reading this from the future... hi bestie, hope the ciphers are ciphering ππ¦π
π¦ where this page comes from
- fedora 44: perl-Net-SSH-Perl 2.144-2.fc44 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms