Method: Digest::Instance#hexdigest
- Defined in:
- ext/digest/digest.c
#hexdigest ⇒ String #hexdigest(string) ⇒ String
If none is given, returns the resulting hash value of the digest in a hex-encoded form, keeping the digest’s state.
If a string is given, returns the hash value for the given string in a hex-encoded form, resetting the digest to the initial state before and after the process.
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 |
# File 'ext/digest/digest.c', line 287 static VALUE rb_digest_instance_hexdigest(int argc, VALUE *argv, VALUE self) { VALUE str, value; if (rb_scan_args(argc, argv, "01", &str) > 0) { rb_funcall(self, id_reset, 0); rb_funcall(self, id_update, 1, str); value = rb_funcall(self, id_finish, 0); rb_funcall(self, id_reset, 0); } else { value = rb_funcall(rb_obj_clone(self), id_finish, 0); } return hexencode_str_new(value); } |