1. #1
    Sencha User
    Join Date
    Jun 2009
    Posts
    47
    Vote Rating
    0
    sape is on a distinguished road

      0  

    Question SHA1 hashing

    SHA1 hashing


    Does anybody know if there is support for SHA1 hashing in GWT-EXT.

    I saw an example for EXT-JS here:
    http://ext.vosandhowden.com/ux/crypto/sha1.cfm

    But I couldn't get it to work with GWT-EXT.

    I created a native method:
    Code:
        public native String hash(String message)/*-{
            return Ext.ux.Crypto.SHA1.hash(message);
        }-*/;
    Included the Javascript file in my module HTML:
    Code:
    <script type="text/javascript" src="gxt/Ext.ux.Crypto.SHA1.js"></script>
    And also in the GWT module file:
    Code:
    <script src="gxt/Ext.ux.Crypto.SHA1.js"></script>
    Does anybody know what I am doing wrong?

    I get the following exception:
    Code:
    [ERROR] Uncaught exception escaped
    com.google.gwt.core.client.JavaScriptException: (TypeError): 'Ext' is undefined
     number: -2146823279
     description: 'Ext' is undefined

  2. #2
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    GXT is not a wrapper around Ext JS. So yuo cannot use the plugins without doing anything. You will need to rewrite it in java code.

  3. #3
    Sencha User
    Join Date
    Jun 2009
    Posts
    47
    Vote Rating
    0
    sape is on a distinguished road

      0  

    Question


    OK thanks.. but does that mean that GWT-EXT doesn't even support password hashing at all?

    Isn't there a crypto library in GWT-EXT?

  4. #4
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    No it doesnt mean that.

    It does mean that the plugin you used is not for GXT and you will need to write an own one.

  5. #5
    Sencha User
    Join Date
    Jun 2009
    Posts
    47
    Vote Rating
    0
    sape is on a distinguished road

      0  

    Question


    Ok that sucks

    Are there any plans to have such a crypto library for GWT-EXT?

  6. #6
    Sencha User
    Join Date
    Sep 2009
    Posts
    289
    Vote Rating
    0
    diegolovison is on a distinguished road

      0  

    Default


    search for GWT its more easy

  7. #7
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,717
    Vote Rating
    88
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      0  

    Default


    The code snippet
    Code:
    public native String hash(String message)/*-{
            return Ext.ux.Crypto.SHA1.hash(message);
        }-*/
    should be
    Code:
    public native String hash(String message)/*-{
            return $wnd.Ext.ux.Crypto.SHA1.hash(message);
        }-*/
    and it will work. The problem is that GWT code is created in an iframe, and the global object Ext doesnt exist there (since your tag is in the main window), so you need to reference the outer window.

    EDIT: Just read sven's comment, and his point if valid - I assumed that the crypto plugin did not depend on other ext code, and that it just ran on its own. My fix will get rid of the specific error
    Code:
    com.google.gwt.core.client.JavaScriptException: (TypeError): 'Ext' is undefined
    so that you can see if the plugin even works with gxt.