Skip to content
Snippets Groups Projects
Select Git revision
  • e645bdc2215b7da3d61a37097c08d73a5db5b37f
  • master default
  • wip-add-ed25519
  • disable-sha1
  • lsh-2.0.4
  • experimental-20050201
  • lsh-1.4.2
  • lsh-1.2
  • lsh_2.1_release_20130626
  • converted-master-branch-to-git
  • nettle_2.4_release_20110903
  • nettle_2.3_release_20110902
  • nettle_2.2_release_20110711
  • nettle_2.1_release_20100725
  • camellia_32bit_20100720
  • nettle_2.0_release_20090608
  • converted-lsh-2.0.4-branch-to-git
  • lsh_2.0.4_release_20070905
  • lsh_2.9_exp_release_20070404
  • nettle_1.15_release_20061128
  • after_experimental_merge_20060516
  • branch_before_experimental_merge_20060516
  • converted-experimental-branch-to-git
  • head_before_experimental_merge_20060516
  • lsh_2.0.3_release_20060509
  • lsh_2.0.2_release_20060127
  • nettle_1.14_release_20051205
  • nettle_1.13_release_20051006
28 results

rsa-decrypt.c

Blame
  • Html.pmod 1.42 KiB
    string *quote_from;
    string *quote_to;
    string *unquote_from;
    string *unquote_to;
    
    void create()
    {
      quote_from=quote_to=unquote_from=unquote_to=({});
      for(int e=0;e<256;e++)
      {
        switch(e)
        {
        case 'a'..'z':
        case 'A'..'Z':
        case '0'..'9':
        case 'å': case 'ä': case 'ö':
        case 'Å': case 'Ä': case 'Ö':
        case 'ü': case 'Ü':
        case '!':
        case '#':
        case '$':
        case '&':
        case '/':
        case '(':
        case ')':
        case '=':
        case '-':
        case '_':
        case '+':
        case '?':
        case '~':
        case '*':
        case ',':
        case '.':
        case ';':
        case ':':
          break;
    
        default:
          quote_from+=({sprintf("%c",e)});
          quote_to+=({sprintf("%%%02x",e)});
        }
        unquote_from+=({sprintf("%%%02x",e)});
        unquote_to+=({sprintf("%c",e)});
      }
    }
    
    string quote_param(string s) { return replace(s,quote_from,quote_to); }
    string unquote_param(string s) { return replace(s,unquote_from,unquote_to); }
    
    string mktag(string tag, mapping params)
    {
      string ret="<"+tag;
      foreach(indices(params),string i)
      {
        ret+=" "+i;
    
        if(stringp(params[i]))
        {
          switch(i)
          {
    	case "href":
    	case "name":
    	  ret+="='"+quote_param(params[i])+"'";
    	  break;
    
    	default:
    	  if(search(params[i],"\"")==-1)
    	    ret+="=\""+params[i]+"\"";
    	  else if(search(params[i],"'")==-1)
    	    ret+="='"+params[i]+"'";
    	  else
    	    ret+="=\""+replace(params[i],"\"","'")+"\"";
          }
        }
      }
      return ret+">";
    }