Last active
October 3, 2015 13:58
-
-
Save tong/2464432 to your computer and use it in GitHub Desktop.
SASL-MD5 remote computation for XMPP clients
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import jabber.sasl.MD5Calculator; | |
| using Lambda; | |
| /** | |
| Simple, remote SASL-MD5 calculator for XMPP clients | |
| */ | |
| class Index { | |
| static var passwords = { | |
| tong : 'test' | |
| }; | |
| static inline function print(t) php.Lib.print(t) | |
| static function main() { | |
| var params = php.Web.getParams(); | |
| var host = params.get( 'host' ); | |
| var servertype = params.get( 'servertype' ); | |
| var username = params.get( 'username' ); | |
| var realm = params.get( 'realm' ); | |
| var nonce = params.get( 'nonce' ); | |
| if( host == null || servertype == null || username == null || realm == null || nonce == null ) { | |
| print(null); | |
| return; | |
| } | |
| var pw = Reflect.field( passwords, username ); | |
| if( pw == null ) { | |
| print(null); | |
| return; | |
| } | |
| var hash : String = null; | |
| try hash = MD5Calculator.run( host, servertype, username, realm, pw, nonce ) catch( e : Dynamic ) { | |
| print(null); | |
| return; | |
| } | |
| print( hash ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment