# Digest::Base#inspect

**URL:** <https://www.ruby-forum.com/t/digest-base-inspect/68582>\
**Category:** Development\
**Created:** [September 13, 2006, 7:25pm UTC](https://www.ruby-forum.com/t/digest-base-inspect/68582 "2006-09-13T19:25:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tanaka\_A](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c67d28/32.png) [@Tanaka\_A](https://www.ruby-forum.com/u/Tanaka_A)\
**Post date:** [September 13, 2006, 7:25pm UTC](https://www.ruby-forum.com/t/digest-base-inspect/68582/1 "2006-09-13T19:25:57Z")

</div>

Digest::SHA256 e$B$N%$%s%9%?%s%9$H$+$re(B p e$B$GI=\<($9$k$H0J2\<$N$h$&e(B  
e$B$Ke(B 16e$B?J$NJ8;zNs$,=P$F$-$^$9!#e(B

% ./ruby -v -rdigest -e ‘p Digest::SHA256.new’  
ruby 1.9.0 (2006-09-13) [i686-linux]  
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855

e$B$@$$$?$$0l0U$G$"$k$H$$$o$l$l$P$=$l$O$=$&$J$N$+$b$7$l$^$;$s$,e(B  
e$B$d$O$j$3$3$O0J2\<$N$h$&$K$J$C$F$[$7$$$N$G$9$,!"$I$&$G$7$g$&e(B?

% ./ruby -rdigest -e ‘p Digest::SHA256.new’  
#\<Digest::SHA256:  
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855\>

# Index: ext/digest/digest.c

RCS file: /src/ruby/ext/digest/digest.c,v  
retrieving revision 1.17  
diff -u -p -r1.17 digest.c  
— ext/digest/digest.c 12 Dec 2005 05:15:33 -0000 1.17  
+++ ext/digest/digest.c 13 Sep 2006 17:20:19 -0000  
@@ -210,6 +210,27 @@ rb\_digest\_base\_hexdigest(VALUE self)  
}

static VALUE  
+rb\_digest\_base\_inspect(VALUE self)  
+{

- algo\_t \*algo;
- VALUE str;
- char \*cname;
- 
- algo = get\_digest\_base\_metadata(rb\_obj\_class(self));
- 
- cname = rb\_obj\_classname(self);
- 
- /\* #\<Digest::Alg: xxxxx…xxxx\> \*/
- str = rb\_str\_buf\_new(2 + strlen(cname) + 2 + algo-\>digest\_len \* 2 +  
1);
- rb\_str\_buf\_cat2(str, “#\<”);
- rb\_str\_buf\_cat2(str, cname);
- rb\_str\_buf\_cat2(str, ": ");
- rb\_str\_buf\_append(str, rb\_digest\_base\_hexdigest(self));
- rb\_str\_buf\_cat2(str, “\>”);
- return str;  
+}
- 

+static VALUE  
rb\_digest\_base\_equal(VALUE self, VALUE other)  
{  
algo\_t \*algo;  
@@ -265,6 +286,7 @@ Init\_digest()  
rb\_define\_method(cDigest\_Base, “digest”, rb\_digest\_base\_digest, 0);  
rb\_define\_method(cDigest\_Base, “hexdigest”,  
rb\_digest\_base\_hexdigest, 0);  
rb\_define\_method(cDigest\_Base, “to\_s”, rb\_digest\_base\_hexdigest,  
0);

- rb\_define\_method(cDigest\_Base, “inspect”, rb\_digest\_base\_inspect,  
0);  
rb\_define\_method(cDigest\_Base, “==”, rb\_digest\_base\_equal, 1);

---

<div class="post-metadata">

**Author:** ![Tanaka\_A](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c67d28/32.png) [@Tanaka\_A](https://www.ruby-forum.com/u/Tanaka_A)\
**Post date:** [September 13, 2006, 9:32pm UTC](https://www.ruby-forum.com/t/digest-base-inspect/68582/2 "2006-09-13T21:32:17Z")

</div>

At Thu, 14 Sep 2006 02:25:09 +0900,  
Tanaka A. wrote:

> Digest::SHA256 e$B$N%$%s%9%?%s%9$H$+$re(B p e$B$GI=\<($9$k$H0J2\<$N$h$&e(B  
> e$B$Ke(B 16e$B?J$NJ8;zNs$,=P$F$-$^$9!#e(B

e$B!!e(Binspect e$B$,$J$+$C$?$s$G$9$M!#F~$l$F$/$@$5$$!#e(B

–  
/  
/\_\_ \_\_ [Akinori.org](http://Akinori.org) / [MUSHA.org](http://MUSHA.org)  
/ ) ) ) ) / [FreeBSD.org](http://FreeBSD.org) / [Ruby-lang.org](http://Ruby-lang.org)  
Akinori MUSHA aka / (\_ / ( (\_\_( @ [iDaemons.org](http://iDaemons.org) / and.or.jp

“Different eyes see different things,  
Different hearts beat on different strings –  
But there are times for you and me when all such things agree”
