Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: [ANN] IMAP/SMTP authentication (cram-md5)

From: rebol-list2:seznam:cz at: 24-Jun-2004 23:56

Hello rebOldes, Saturday, June 19, 2004, 12:26:26 AM, you wrote: r> Hello rebolist, r> I've just found (on Altme) that SMTP authentication is needed, r> I don't use it but from some strange reason I did this function r> some time ago which may be useful, so check it out. r> -- r> Best regards, r> rebOldes -----------------[ http://oldes.multimedia.cz/ ] r> -- Binary/unsupported file stripped by Ecartis -- r> -- Type: text/x-rebol r> -- File: cram-md5.r Ech... so it's not possible to send Rebol script on ML:( REBOL [ Title: "Cram-md5" Date: 24-Dec-2003/13:30:21+1:00 Version: 0.1.0 Author: "oldes" Usage: [ ;Using values from RFC2195 probe cram-md5 "tim" "<[1896--697170952--postoffice--reston--mci--net]>" "tanstaaftanstaaf" ] Purpose: { This function returns CRAM-MD5 authentication string which may be used form IMAP or SMTP Authentication. Check RFC2195, RFC2554 and RFC2085 for more details. } Email: "oliva.david at seznam.cz" ] cram-md5: func[ user_name text shared_key [string!] "string known only to the client and server" /local ipad opad ][ either 64 < length? shared_key [ shared_key: checksum/method shared_key 'md5 ][ shared_key: to binary! shared_key ] insert/dup tail shared_key #{00} 64 - length? shared_key ipad: make binary! 64 insert/dup ipad #{36} 64 opad: make binary! 64 insert/dup opad #{5C} 64 text: checksum/method rejoin [(shared_key XOR ipad) text] 'md5 text: checksum/method rejoin [(shared_key XOR opad) text] 'md5 parse/all lowercase form text [2 skip copy text to #"}"] enbase/base rejoin [user_name " " text] 64 ] -- Best regards, rebOldes -----------------[ http://oldes.multimedia.cz/ ]