From 1a7fc12e8655d65620b19ad6e09592aef95f68c8 Mon Sep 17 00:00:00 2001 From: Dante Catalfamo Date: Sun, 4 Jul 2021 03:13:03 -0400 Subject: bsd-auth: Add color to lines in graph, add copyright and license --- content/posts/WIP-how-bsd-authentication-works/gen_dot.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'content/posts/WIP-how-bsd-authentication-works/gen_dot.rb') 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 -- cgit v1.2.3