diff options
| author | Dante Catalfamo | 2021-07-04 03:13:03 -0400 | 
|---|---|---|
| committer | Dante Catalfamo | 2021-07-04 03:13:03 -0400 | 
| commit | 1a7fc12e8655d65620b19ad6e09592aef95f68c8 (patch) | |
| tree | d84aaa7c841422be44ac7372226d62199d0f94de /content/posts/WIP-how-bsd-authentication-works/gen_dot.rb | |
| parent | 070dc77a81992fd01c73b21967ab02ad64a780e8 (diff) | |
| download | blog-1a7fc12e8655d65620b19ad6e09592aef95f68c8.tar.gz blog-1a7fc12e8655d65620b19ad6e09592aef95f68c8.tar.bz2 blog-1a7fc12e8655d65620b19ad6e09592aef95f68c8.zip  | |
bsd-auth: Add color to lines in graph, add copyright and license
Diffstat (limited to 'content/posts/WIP-how-bsd-authentication-works/gen_dot.rb')
| -rwxr-xr-x | content/posts/WIP-how-bsd-authentication-works/gen_dot.rb | 11 | 
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  | 
