summaryrefslogtreecommitdiffstats
path: root/content/posts/WIP-how-bsd-authentication-works/gen_dot.rb
diff options
context:
space:
mode:
Diffstat (limited to 'content/posts/WIP-how-bsd-authentication-works/gen_dot.rb')
-rwxr-xr-xcontent/posts/WIP-how-bsd-authentication-works/gen_dot.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/content/posts/WIP-how-bsd-authentication-works/gen_dot.rb b/content/posts/WIP-how-bsd-authentication-works/gen_dot.rb
index 7244789..bad2a90 100755
--- a/content/posts/WIP-how-bsd-authentication-works/gen_dot.rb
+++ b/content/posts/WIP-how-bsd-authentication-works/gen_dot.rb
@@ -1,6 +1,11 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
+# Copyright (c) 2021 Dante Catalfamo
+# SPDX-License-Identifier: MIT
+
+require 'digest'
+
SOURCE_DIR = File.join Dir.home, 'src', 'github.com', 'openbsd', 'src', 'lib', 'libc', 'gen'
FILENAMES = %w[authenticate.c auth_subr.c login_cap.c].freeze
@@ -36,8 +41,12 @@ class FunctionDigraph
@to = to
end
+ def color(func)
+ Digest::MD5.hexdigest(func)[..5]
+ end
+
def emit
- puts "#{from} -> #{to}" if to =~ /auth|login|^_/
+ puts "#{from} -> #{to} [color = \"##{color(from)}\"]" if to =~ /auth|login|^_/
end
end