Forum: Ruby on Rails Why would BlueCloth use an EscapeTable of MD5 hash values?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
53d4002427665db72120f3fa0714ea52?d=identicon&s=25 Ruby.Me.Silly (Guest)
on 2007-04-08 07:33
(Received via mailing list)
I was looking at the source code to BlueCloth and came across the
following lines of code:

# Table of MD5 sums for escaped characters
  EscapeTable = {}
  '\\`*_{}[]()#.!'.split(//).each {|char|
    hash = Digest::MD5::hexdigest( char )

    EscapeTable[ char ] = {
       :md5 => hash,
      :md5re => Regexp::new( hash ),
      :re  => Regexp::new( '\\\\' + Regexp::escape(char) ),

One particular use of the EscapeTable is in this function:
### Escape special characters in the given +str+
  def escape_special_chars( str )
    @log.debug "  Escaping special characters"
    text = ''

    # The original Markdown source has something called '$tags_to_skip'
    # declared here, but it's never used, so I don't define it.

    tokenize_html( str ) {|token, str|
      @log.debug "   Adding %p token %p" % [ token, str ]
      case token

      # Within tags, encode * and _
      when :tag
        text += str.
          gsub( /\*/, EscapeTable['*'][:md5] ).
          gsub( /_/, EscapeTable['_'][:md5] )

      # Encode backslashed stuff in regular text
      when :text
        text += encode_backslash_escapes( str )
        raise TypeError, "Unknown token type %p" % token

    @log.debug "  Text with escapes is now: %p" % text
    return text

Now can someone please tell me why you would want to escape this
particular set of characters?  In addition, why use an md5 hash?  Why
not an entity character reference?
This topic is locked and can not be replied to.