Skip to content

Commit

Permalink
Merge pull request #6 from hampuslidin/master
Browse files Browse the repository at this point in the history
Implement fingerprint randomart generation
  • Loading branch information
Leo1003 authored Feb 11, 2022
2 parents edef54c + 9ccaa2f commit 3574ff5
Show file tree
Hide file tree
Showing 23 changed files with 368 additions and 1 deletion.
11 changes: 11 additions & 0 deletions assets/openssh_dsa.randomart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
+---[DSA 1024]----+
| .=+ |
| ..... . |
| .+oo . .o |
| .== + o++o |
| .==+ =+S=.. |
|.+Eo...+*.o |
|+ . +.=. |
| . . +... . |
| .o .. .o |
+----[SHA256]-----+
11 changes: 11 additions & 0 deletions assets/openssh_dsa_enc.randomart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
+---[DSA 1024]----+
| |
| |
| E o|
| . . = |
| . . S. o = o|
| . o ooo . * @.|
| o o.... + @ +|
| o.+=o+ o * + |
| B+.+.*=o o.+|
+----[SHA256]-----+
11 changes: 11 additions & 0 deletions assets/openssh_ecdsa.randomart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
+---[ECDSA 256]---+
| . o=++++ .o.|
| + ..+..= =o.o|
| o + .++ * o=*|
| + o .+ * . +B|
| . . oS.E + .o+|
| . . .o o +|
| . . . |
| |
| |
+----[SHA256]-----+
11 changes: 11 additions & 0 deletions assets/openssh_ecdsa_enc.randomart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
+---[ECDSA 384]---+
| . ..+|
| . . o .=|
| . . o o o o ...|
| o . + O o = .|
| . o S X o + =|
| . * + o Bo|
| E o o.*|
| . +o*|
| .. OO|
+----[SHA256]-----+
11 changes: 11 additions & 0 deletions assets/openssh_ed25519.randomart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
+--[ED25519 256]--+
| .... . =.|
| o+o. . o . =E*|
| o=+.+ + o o =.|
| ++..o + . + |
| ... + S + o |
| .+ o . . o |
| .o o o . |
|.....=. |
| ++oo+o |
+----[SHA256]-----+
11 changes: 11 additions & 0 deletions assets/openssh_ed25519_enc.randomart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
+--[ED25519 256]--+
| . |
|E o |
|++. . |
|@o+ . . |
|=X+.o + S |
|.=+= = + . |
| @ = + . |
|.=o% o |
|++O*+ |
+----[SHA256]-----+
11 changes: 11 additions & 0 deletions assets/openssh_rsa.randomart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
+---[RSA 2048]----+
| |
| o |
| . . o . |
| o . . . |
| o . S . |
|oo. .. . . |
|+=*+E= . o |
|B@=*= * . |
|#@@*==.. |
+----[SHA256]-----+
11 changes: 11 additions & 0 deletions assets/openssh_rsa_enc.randomart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
+---[RSA 2048]----+
|o . .. |
|.+ o . . . |
|... E . . o |
|+ o o o. + |
|Bo .. S oo + |
|+O.o + .* o |
|++B o o . * |
|++.* . o |
|ooo.+ .. |
+----[SHA256]-----+
11 changes: 11 additions & 0 deletions assets/pem_dsa.randomart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
+---[DSA 1024]----+
|B=o**BOo. |
|+*B +Eoo. |
|O+.= . +o |
|*.. o o+. |
| + ooSo |
| + o .oo o |
| + o |
| |
| |
+----[SHA256]-----+
11 changes: 11 additions & 0 deletions assets/pem_dsa_enc.randomart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
+---[DSA 1024]----+
| + o+.. |
|o *.oo |
| = = . |
|o =o.. + . |
|+=E.o S o . |
|+=+. o o |
|+=B. |
|B*oo |
|BBBo |
+----[SHA256]-----+
11 changes: 11 additions & 0 deletions assets/pem_ecdsa.randomart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
+---[ECDSA 256]---+
|@*=. .*.... |
|*=@+o + +.. |
|=@=O.. +o+ |
|=+Eo* .o+o. |
|. o . S. . |
| . |
| |
| |
| |
+----[SHA256]-----+
11 changes: 11 additions & 0 deletions assets/pem_ecdsa_enc.randomart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
+---[ECDSA 256]---+
| E+ o.**oo++ |
| . . *==oo.....|
| o BoO . +.+|
| . = % = o o+|
| o S = o o .|
| o o . |
| + . |
| o |
| |
+----[SHA256]-----+
11 changes: 11 additions & 0 deletions assets/pem_rsa.randomart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
+---[RSA 2048]----+
| |
| o |
| . . o . |
| o . . . |
| o . S . |
|oo. .. . . |
|+=*+E= . o |
|B@=*= * . |
|#@@*==.. |
+----[SHA256]-----+
11 changes: 11 additions & 0 deletions assets/pem_rsa_enc.randomart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
+---[RSA 2048]----+
| ...E==+=|
| .+.* ooo.|
| ...* = ..|
| +.o + .o |
| o S o o =oo|
| o = = o.==|
| o o . .o=|
| ++|
| .+|
+----[SHA256]-----+
11 changes: 11 additions & 0 deletions assets/pkcs8_rsa.randomart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
+---[RSA 4096]----+
| .oX%==o+=E+|
| oo*OBO..o =|
| =o.@ o .. |
| .ooo = . ..|
| o.So o .|
| . . |
| |
| |
| |
+----[SHA256]-----+
11 changes: 11 additions & 0 deletions assets/pkcs8_rsa_enc.randomart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
+---[RSA 4096]----+
| |
| . . |
| + |
| + . |
| = S. |
| . Bo+. |
| ..o.+..Bo+ |
|.o*+oo+oo=.o |
|.*X@B+o+o.++E |
+----[SHA256]-----+
10 changes: 10 additions & 0 deletions src/keys/dsa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ use std::fmt;

/// The key name returned by [`Key::keyname()`](../trait.Key.html#method.keyname)
pub const DSA_NAME: &str = "ssh-dss";
/// The key name returned by [`Key::short_keyname()`](../trait.Key.html#method.short_keyname)
pub const DSA_SHORT_NAME: &str = "DSA";

/// Represent the DSA public key
#[derive(Debug, Clone)]
Expand Down Expand Up @@ -51,6 +53,10 @@ impl Key for DsaPublicKey {
fn keyname(&self) -> &'static str {
DSA_NAME
}

fn short_keyname(&self) -> &'static str {
DSA_SHORT_NAME
}
}

impl PublicParts for DsaPublicKey {
Expand Down Expand Up @@ -128,6 +134,10 @@ impl Key for DsaKeyPair {
fn keyname(&self) -> &'static str {
DSA_NAME
}

fn short_keyname(&self) -> &'static str {
DSA_SHORT_NAME
}
}

impl PublicParts for DsaKeyPair {
Expand Down
10 changes: 10 additions & 0 deletions src/keys/ecdsa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ pub const NIST_P256_NAME: &str = "ecdsa-sha2-nistp256";
pub const NIST_P384_NAME: &str = "ecdsa-sha2-nistp384";
/// The name of 521 bits curve key returned by [`Key::keyname()`](../trait.Key.html#method.keyname)
pub const NIST_P521_NAME: &str = "ecdsa-sha2-nistp521";
/// The short name of ECDSA returned by [`Key::short_keyname()`](../trait.Key.html#method.short_keyname)
pub const ECDSA_SHORT_NAME: &str = "ECDSA";

/// An enum of the supported elliptic curves
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
Expand Down Expand Up @@ -155,6 +157,10 @@ impl Key for EcDsaPublicKey {
fn keyname(&self) -> &'static str {
self.curve.name()
}

fn short_keyname(&self) -> &'static str {
ECDSA_SHORT_NAME
}
}

impl PublicParts for EcDsaPublicKey {
Expand Down Expand Up @@ -277,6 +283,10 @@ impl Key for EcDsaKeyPair {
fn keyname(&self) -> &'static str {
self.curve.name()
}

fn short_keyname(&self) -> &'static str {
ECDSA_SHORT_NAME
}
}

impl PublicParts for EcDsaKeyPair {
Expand Down
10 changes: 10 additions & 0 deletions src/keys/ed25519.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ use std::{convert::TryFrom, fmt};

/// The key name returned by [`Key::keyname()`](../trait.Key.html#method.keyname)
pub const ED25519_NAME: &str = "ssh-ed25519";
/// The short key name returned by [`Key::short_keyname()`](../trait.Key.html#method.short_keyname)
pub const ED25519_SHORT_NAME: &str = "ED25519";

/// Represent the Ed25519 public key
#[derive(Debug, Clone)]
Expand All @@ -42,6 +44,10 @@ impl Key for Ed25519PublicKey {
fn keyname(&self) -> &'static str {
ED25519_NAME
}

fn short_keyname(&self) -> &'static str {
ED25519_SHORT_NAME
}
}

impl PublicParts for Ed25519PublicKey {
Expand Down Expand Up @@ -80,6 +86,10 @@ impl Key for Ed25519KeyPair {
fn keyname(&self) -> &'static str {
ED25519_NAME
}

fn short_keyname(&self) -> &'static str {
ED25519_SHORT_NAME
}
}

impl Ed25519KeyPair {
Expand Down
Loading

0 comments on commit 3574ff5

Please sign in to comment.