Hash function - seeking for example

Can some one give me an example of Hash function in flex. I wont to turn a string to hash code and then test if other string is giving me same hash code or in other words: I wont to set a password as part of my flex app.
This is what I found http://help.adobe.com/en_US/FlashPlatform/beta/reference/actionscript/3/mx/utils/SHA256.ht ml on the help pages.
I hope you be able to help me.

var b:ByteArray = new ByteArray();
b.writeMultiByte(data.toString(), "UTF-8");
SHA256.computeDigest(b);

Similar Messages

  • HT1937 Dear Sirs, i have a sugestion to the Apple that: in IOS7 you should add a funtion time limited for a call. For example after talking 10 minutes the phone will hang up. Thank you very much.  Truly, Nguyen Tuan Thinh

    Dear Sirs,
    I have used an Iphone 5 for some months ago. But I cannot find the way to hang up automatically. So I suggest to the Apple that in IOS7, you should ad that function. For example, after talking 8 or 10 ... Minutes, the phone can hang up automatically. Because, there are many services provider promost 10 minutes free.
    Thank you very much.
    Tuan Thinh

    We are not Apple, we are users just like you. To communicate with Apple go to http://www.apple.com/feedback/iphone.html

  • Hash function question

    I'm working with hash codes for string objects. Here's the method i'm using (i think this is the same as the normal string hash function, except for mine supports skipping characters):
    public int hashCode () {
            int h;
            h = 0;
            for (int i = 0, len = rep.length (), step = skip; i < len; i += step)
                h = h*31 + rep.charAt (i);
            return h;
        }This comes from a wrapper class that holds a string (REP) as well as an int SKIP that causes the hash function to skip characters in the string (my question won't be dealing with SKIP, ie, assume SKIP is one for the purposes of this question).
    I'm running this hash function on four-character "words" of the form "xxyy" (where x and y are some value between 1 and a specified N, where N is by usage usually less than 300 or so) and also on words of the form xXyY (where x, y, and N are the same as before, and X=2^16 - 31x - 1 and Y=2^16 - 31y - 1).
    So the question is, will this hash function take longer to run on xXyY words than it will on xxyy words? if so, why?

    If X and x, as well as Y and y, are of the same type but merely hold different values, and the strings are of equal length, that shouldn't matter performance-wise.

  • Looking for example - abap xslt - that uses xslt document() function

    Hello,
    I'm looking for an example that shows the use of abap xslt with the xslt document() function.  Using the xslt document() function seems like a straightforward way to use xslt to create a result xml document by processing the content of two or more
    source documents.  For example, if source document A.xml and aux.xml are available in  memory as xstringand using stylesheet ztransformwhat would be the argument for the document() function to associate aux.xml.  Thanks for any insight.
    Regards,
    jb10809

    Hi,
    Sorry, perhaps I should have been clearer! The function that I picked just to test what you need to do just happened to return a string that contains SPAN tags with style attributes. The actual function code is:
    create or replace FUNCTION out_string_fn
       RETURN VARCHAR2
    IS
       CURSOR emp_cur
       IS
          SELECT ename
            FROM emp;
       v_string   VARCHAR2 (4000);
    BEGIN
       v_string := ' ';
       FOR c IN emp_cur
       LOOP
          v_string :=
                v_string
             || '&lt;SPAN style="font-weight:bold;color:green"&gt;'
             || c.ename
             || '&lt;/SPAN&gt;'
             || ', &lt;/br&gt;&lt;/br&gt;';
       END LOOP;
       RETURN v_string;
    END;And this returned a naff list in green (see [http://apex.oracle.com/pls/otn/f?p=55041:57] and click the Test button) - but it does show that you can style the validation error messages
    Andy

  • Hi! If I buy an ipod touch 5g from the US and I travel to another country, for example Philippines, will it function in that country without having to modify anything from the device?

    Hi! If I buy an ipod touch 5g from the US and I travel to another country, for example Philippines, will it function in that country without having to modify anything from the device?

    Thanks Varjak Paw

  • IPhone Thai language keyboard should be improved. For example ฃ should be ซ instead. Shift function should be alt ...

    iPhone
    Thai language keyboard should be improved. For example ฃ should be ซ instead. Shift function should be alternative or less as possible. Contact me for other details

    Nobody is going to contact you.  Instead, you must send your details to Apple using
    http://www.apple.com/feedback

  • By asking for the function seek and replace [apple F] i get no display - so see nothing except the upper stroke. what is going on? and what can i do about it?

    by asking for the function seek and replace [apple F] i get no display - so see nothing except the upper grey line. what is going on? and what can i do about it?
    restarting doesn't work

    Does trashing the preferences help? See Replace Your Preferences

  • TS3048 I have just purchased a new apple cordless keyboard.  The numeric line of keys along the top are not functioning as they should.  For example I am unable to get a question mark or a forward slash.  I have tried holding down both shift and alt keys.

    I have just purchased a new apple cordless keyboard.  The numeric line of keys along the top are not functioning as they should.  For example I am unable to get a question mark or a forward slash.  I have tried holding down both shift and alt keys.

    Thanks for prompt response - I tried what you suggested but I'm afraid it has not helped.  It seems as though the line of number keys along the top aren't actually doing what is printed on them.  Some are OK, but the further towards the right hand side of the keyboard you go, the less predicatable it becomes.  So whilst the second key from the left gives me 1 and ! when holding the shift key, by the time I get to the 6 when I press and hold shift I get ^ rather than & symbol which is what is actually printed on the key.  The & symbol is actually on the next key along - and when I hit the key with 8 I get * rather than the ( which is printed on they key but actually located on the next key along.  Things get even more muddled by the time I am over on the right hand side as rather than a question mark (I have had to type the word as I cannot find the symbol anywhere!) I get this _ and the other symbol marked on the key is a comma, but I get - instead.  It is going to drive me mad if every time I want to type something it is a guessing game....!  What do you suggest - question mark

  • Hash function for the DB_HASH access method

    Hello!
    I use BDB 4.5.20 and tried to use a DB_HASH access method providing my own hash function, since I have very specific keys. Keys are UUID, and they all have the same length (16 bytes) and specific binary representation which can be used to generate hash code. After I set own hash function using Db::set_h_hash() I get the call of this function during database open with a very strange data I was not expected.
    Backtrace is:
    storaged.dll!tbricks::storage::StorageBDBBackend::bdb_hash_func(Db * db=0x01dba398, const void * key=0x1318326c, unsigned int size=12) Line 35     C++
    libdb45d.dll!_db_h_hash_intercept_c(__db * cthis=0x01dba418, const void * data=0x1318326c, unsigned int len=12) Line 483 + 0x97 bytes     C++
    libdb45d.dll!__ham_init_meta(__db * dbp=0x01dba418, hashmeta33 * meta=0x01dbb120, unsigned int pgno=0, _db_lsn * lsnp=0x0013f10c) Line 291 + 0x13 bytes     C
    libdb45d.dll!__ham_new_file(__db * dbp=0x01dba418, __db_txn * txn=0x01dbacc8, __fh_t * fhp=0x01dbafb8, const char * name=0x01dbac60) Line 402 + 0x13 bytes     C
    libdb45d.dll!__db_new_file(__db * dbp=0x01dba418, __db_txn * txn=0x01dbacc8, __fh_t * fhp=0x01dbafb8, const char * name=0x01dbac60) Line 284 + 0x15 bytes     C
    libdb45d.dll!__fop_file_setup(__db * dbp=0x01dba418, __db_txn * txn=0x01dba9e0, const char * name=0x01585624, int mode=384, unsigned int flags=129, unsigned int * retidp=0x0013f458) Line 586 + 0x42 bytes     C
    libdb45d.dll!__db_open(__db * dbp=0x01dba418, __db_txn * txn=0x01dba9e0, const char * fname=0x01585624, const char * dname=0x00000000, DBTYPE type=DB_HASH, unsigned int flags=129, int mode=0, unsigned int meta_pgno=0) Line 154 + 0x1d bytes     C
    libdb45d.dll!__db_open_pp(__db * dbp=0x01dba418, __db_txn * txn=0x01dba9e0, const char * fname=0x01585624, const char * dname=0x00000000, DBTYPE type=DB_HASH, unsigned int flags=129, int mode=0) Line 1079 + 0x23 bytes     C
    libdb45d.dll!Db::open(DbTxn * txnid=0x00000000, const char * file=0x01585624, const char * database=0x00000000, DBTYPE type=DB_HASH, unsigned int flags=33554561, int mode=0) Line 313 + 0x30 bytes     C++
    storaged.dll!tbricks::storage::BDBBackend::open_db(Db & db={...}, const char * fileName=0x01585624, DBTYPE dbType=DB_HASH) Line 372 + 0x21 bytes     C++
    Db::set_h_hash() documentation says nothing about behaviour like this.
    Why BDB calls my hash function during database open while I do not put()/get() any data?
    Firstly I was implemented hash function aborting the application if key length is not equal 16, because it looks like application internal error, and for sure application was aborted because of that.
    How should I treat this data and do I have to return any hash code at all in this case?

    A quick look at the code indicates that this call is to run the hash function against a known value ("%$sniglet^&") to store the result in the DB file (or to compare the result against a result stored in the file, if the file already exists). Since a failure of this comparison prints "hash: incompatible hash function", I think we can assume that this is done to ensure the hash function being used is compatible with the hash function used when the DB file was created.
    So you need to be able to provide some form of hash output for this.

  • One way hash function in java

    Simply i want to save a password entered to a java program and save it in a MySQL database
    Here I want to encrypt that password and save it in the database.... I prefer one way hash function encryption because it fulfills my need.
    SHA-1 is the best in java now as I read from a article, is it?
    What I need is that if someone can post a complete code which uses SHA-1 (if it is the best preferred one).
    I've tried some codes published in the web but didn't work
    one code worked very well but when I entered characters like "@#$%%" it failed.
    Thank You!!!

    797241 wrote:
    I've search using your key terms and got a good code that works ("java sha-1 example")
    thanks for that
    I didn't got that when i was searchingHard to believe.
    So suggesting that working link was enough though you've put some other annoying comment tooIt is considered extremely bad mannered just to ask for code. If you have presented code that has problems and ask for help in fixing the problems you will normally get help but just to ask for code implies you are very lazy.
    thanks for that too
    I would rather prefer if you would have written "You are not going to get an answer, get the hell out of here!!!"Now that would have invoked the wrath of the moderators!
    P.S. Just using a SHA-1 digest is insecure as the result is open to a dictionary attack. You should use a randomly seeded digest with both the random value and digest value being stored in the database.

  • Help with Hash Function in Properties

    Hi, I need to know the algorithm of the Hash Function that is used by Java in its HashMap, Properties, etc... classes.
    Can I get it somewhere or is it private? I need it for documentation purposes.
    Thanks!
    Sigurd

    Hi.
    You can download the source for the entire JDK from the usual download locations, so you can see the details of the implementation there. If you're looking for a higher level description, I don't know where you'd find that, other than a few pages which document general ways to get well distributed hashes; look at http://java.sun.com/developer/Books/effectivejava/Chapter3.pdf for an example of this - a chapter from the mighty Joshua Bloch's 'Effective Java'.
    Regards,
    Lance

  • Secure hash function with salt to create a not spoofable PRC (SAP CRM)

    Hello SAP Security Community,
    SAP CRM Marketing provides a functionality called Personalized Response Code (PRC, 10 characters). This code can be used in mail, fax, sms or letters to customers. When the customer returns the PRC to the communication initiator, it can be mapped to a campaign and the business partner number of the customer. See also the [SAP Standard Help|http://help.sap.com/saphelp_crm700_ehp01/helpdata/EN/2a/c13463f09c4a1f9c45903e7a0a7230/frameset.htm].
    By default this standard implementation of the BAdI CRM_MKT_PRC_CONVERT is called:
    METHOD if_ex_crm_mkt_prc_convert~convert_prc.
      DATA lv_no      TYPE  crmt_mkt_icrh_prc_num.
      DATA lv_string  TYPE  string.
      DATA lv_pos     TYPE  int4.
      DATA lv_base31  TYPE  string VALUE '0123456789BCDFGHJKLMNPQRSTVWXYZ'.
    **** converting the numeric-base10 into base31
      lv_no = iv_prc.
      CLEAR lv_string.
      DO.
        lv_pos = lv_no MOD 31.
        lv_no  = lv_no DIV 31.
        CONCATENATE lv_base31+lv_pos(1) lv_string INTO lv_string.
        IF lv_no = 0.
          EXIT.
        ENDIF.
      ENDDO.
      MOVE lv_string TO ev_prc.
    ENDMETHOD.
    As you can see it does a simple base31 encoding of the provided input parameter iv_prc which is a number provided by the number range for PRC's.
    I want to use the PRC to make our customers registration process for a trade fair easier. We send out the PRC via a letter to the customers where we don't have an E-Mail address. The letter contains instructions which point the user to a Website that has an input field for the PRC. When the user submits the PRC I'd like to show him/her some personal information (Name, Address, E-Mail) that we lookup using the PRC in the CRM System. This information is then posted to a 3rd party website that has to be used to do the trade fair registration.
    If I would use the simple base31 encoding, then the current counter state could be easily decoded, the next number can be chosen and by applying base31 encoding again, the next valid PRC is created. This could then be misused to read personal information of another customer. I think what could solve this problem would be to use a secure hash function that allows also to be salted to create the PRC.
    Do you think I'm on the right track? Or would it be OK to use the classes described in [Note 1410294 - Support SHA2-family for Message Digest and HMAC|https://service.sap.com/sap/support/notes/1410294] and before doing the hashing add a random number to the PRC number that I've got from the number range? What problems do I run in as the PRC could not be longer than 12 characters? For sure I have to check that I don't create any PRC twice.
    Best regards
    Gregor

    Knowledge of PCR should not reveal any personal information to you.
    OK, but in this case the PCR is mapped to the campaign number and the BP-number. It would reveal the information.  Hence a second hash which only allows further processing if it matches. The second hash is a "signature" of the PCR.
    I don't agree with this. The security should NOT be based on hiding how system works. Only key should be secret. In this case it should all depend on quality of PRNG. Check Kerckhoffs's principle. Whenever I see proprietary algorithm in crypto I start to feel nervous about the system.
    Ok, you convinced me. That is also true, but you will have to save the key or the hash it produces to be able to verify it again when the user returns to the website - and in this case it is in clear text ABAP (unless Mr. Wolf wants to create an external program, like SAP does with C-calls).
    From the perspective of the user it is a password and they must be able to transfer it from a snail-mail readable text on paper into a website field.
    As Mr. Wolf has noticed, the next PCRs can be obtained by anyone who can decode standard code (knowing that the BADI is activated).
    I think a correctly placed split and concatenation does the trick for a 20 character field without knowing which part is the PCR and which is the signature (a human can still enter that into a website field).
    I think the big question (appart from the principle - which I agree with you on) is whether the admins and their family members are allowed to bid? Also do the bidders have acces to this system as technical consultants?? (for example to single test methods and function modules in the production system??).
    Also how does the process continue and finally get concluded? Typically there is some "horse trading" in the end anyway... 
    All these factors should influence the strength and complexity of the design, and maintenance of it IMO.
    But generally you are correct and I rest my case.
    @ Mr. Wolf: Are you enjoying the debate too much or are you going to give us more insight?
    Cheers,
    Jules

  • A hash function

    Hi,
    I am doing a project in which I hope to build a database on the one of 3 servers and in fact I will build 3 databases totally. When I send keys and datas to server from client, I hope to put them into databases equally, i.e. the amount of data on every server are as equal as possible. Now, I am using the following method:
    In general, key is string and I convert the string to number N;
    m = N % 3;
    if m = 1, put the key and the corresponding data into the database on server 1;
    if m = 2, put the key and the corresponding data into the database on server 2;
    if m = 3, put the key and the corresponding data into the database on server 3;
    When I query the data, I also use m' = N % 3 to decide which server I should go to search my data.
    Right now the problem is that for persons, most of them may use some letters more often than other letters. And thus the amount of the three databases may be not equal. Can any one give another method, a hash function, to solve this problem or give me some ideas about some books or some websites?
    Thanks a lot.

    I think that the following method can is good for the
    evenly distribution,and this is on the webstie of
    http://wwwcsif.cs.ucdavis.edu/~fletcher/classes/110W98/
    ecture_notes/hash.html
    Polynomial addressing:
    If x is a character string of standard length L (a
    very common situation), then form a polynomial using
    the ASCII values of each character. For example:
    x = ABC
    h(x) = 32^2 * 'A' + 32 * 'B' + 'C'
    Points to note:
    The ASCII values of each character are represented by
    the character placed between single quotes
    The factor 32 is used because it represents
    left-shifting by 5 bits
    This is easily computed using Horner's Rule: in this
    example,
    h(x) = (32 * 'A' + 'B') * 32 + 'C'
    This is easily coded as an iterative loop for
    arbitrary length L
    The general formula for strings of length L:
    h(x) = 32^(L-1) * x1 + 32^(L-2) * x2 + ... + xL
    If the polynomial gets too large during computation
    using Horner's rule, then you can mod out by the table
    size after each iteration:
    h = x1;
    for(i = 2; i <= L; i++)
    h = (h * 32 + xi) % Size;
    (going around in circles)
    This is EXACTLY how String's hashcode function is implemented! At least in the JDKs I have (1.3.1 --> 1.4.2). So my question is still: What's wrong with it?
    Apparently nothing!
    Suns implementation in String uses 31 as the 'magic' number which is perhaps better than 32 because instead of being a single shift, 31 acts as a distributed sum of shifts so that each input bit ends up affecting more bits in the hashcode. So, for example, the LSB's value will reflect every input received (instead of possibly just the last). Nice huh? This is especially important if you're going to %3 the value.
    sjasja's suggestion using 33 as the value has a similar effect.
    So to ensure consisteny (as was overlooked by me and suggested by sjasja) cut&paste the code from String.hashcode and use it.

  • Does the online function cater for a PDF file created in version 9 to be converted to version 6

    I am running Win98SE on one computer (A) and WindowsXP on another computer (B).
    On Computer A I am running Adobe Reader 6.06.
    On Computer B I am running Adobe Reader 9
    Is there a methodology (presumably outside of Adobe Reader) to convert a version 9 file to a version 6 file so that it can be opened in Computer A?
    Microsoft Office Word/Excel for example allows files created in current versions of Office to be opened in the current version and saved as an earlier version.
    Does one have to buy the full Adobe Acrobat package to get a similar function?

    No. Reader is just that a reader of pdf files. You would need Acrobat Standard or Pro to change a file to be read by an earlier version.

  • Function module for getting Vendor Address details

    Hi,
    Im new to this group,and new to ABAP
    plz hep me out by solving ABAP Query...
    i want to generate a report for getting Vendor Details
    like Vendor address,Ph num and Email
    input fields are Company code,country key and Account Group.
    im Using Smart Forms for this..
    but im not getting the Exact Function module to get All Required Details..
    regards
    Smitha

    thanks for ur quick reply...
    SELECT SINGLE LIFNR
      FROM LFB1
      INTO V_LIFNR
      WHERE BUKRS EQ V_BUKRS.
      CALL FUNCTION 'VENDOR_READ'
        EXPORTING
          i_bukrs         = V_BUKRS
          i_lifnr         = V_LIFNR
        EXCEPTIONS
         NOT_FOUND       = 1
         OTHERS          = 2
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    this is the code i have written...
    but my problem is there no table in the Function module....
    for Example...
    CALL FUNCTION 'QPAX_PLMKB_READ_FROM_PLKO'
        EXPORTING
          i_plnty            = 'Q'
          i_plnnr            = V_PLNNR
          I_PLNAL            = V_PLNAL
          i_sttag            = V_DATUV
       TABLES
        T_PLMKB_TAB        = IT_TAB
    i want the function modules with tables and proper input...

Maybe you are looking for