CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2003
    Location
    Malaysia
    Posts
    62

    HELP! Need help to understand these codes! ..(BYTE)(....

    char m_cTestChar;


    for(int m_iCountString=0;m_iCountString<m_iNumberOfTextLongBlock;m_iCountString++)
    {
    for(int m_iCount4Long=3;m_iCount4Long>=0;m_iCount4Long--)
    {
    m_cTestChar=(BYTE)(m_lEcrpTeksArry.GetAt(m_iCountString)>>(m_iCount4Long*8));

    if(m_cTestChar==0)
    {
    BilZero++;
    m_sEncryTea+="#";
    m_iKor=(BYTE)((m_iCountString*4)+(3-m_iCount4Long));
    m_sEncryTea="END"+m_sEncryTea;
    m_sEncryTea=m_iKor+m_sEncryTea;
    m_sEncryTea="ZERO"+m_sEncryTea;

    if(BilZero>20)
    {
    AfxMessageBox("The Encryption Key is Not Suitable, please choose another one!");
    return;
    }
    }

    else
    m_sEncryTea+=(BYTE)(m_lEcrpTeksArry.GetAt(m_iCountString)>>(m_iCount4Long*8));




    hello...i really need to know what the codes about works...!!
    Especially this :
    m_cTestChar=(BYTE)(m_lEcrpTeksArry.GetAt(m_iCountString)>>(m_iCount4Long*8));

    for ur information.. i'd converted a set of strings into LONG blocks.. then encrypted them using TEA Algoritm.. and now..this part.. a friend of mine e-mailed me.. its for "CONVERTING THE EXCRYPTED TEXTS INTO STRING"...
    I'm sorry i really need u guys to help me understand these codes..as my friend also dunno how it works..

    Thanks in advance.
    Regards,
    Thong
    twh81@tm.net.my
    ..to have the most amazing dream...

  2. #2
    The line retrieves the value stored in the index m_iCountString in the member array m_lEcrpTeksArry (an encryption key, I assume) and extracts a byte from it. Notice that, due to the way m_iCount4Long is used, I can assume that the code given reads a long value, MSB (most significant byte) first.

    If 20 zero-bytes appear in the key, it is considered invalid.

  3. #3
    Join Date
    Mar 2003
    Location
    India {Mumbai};
    Posts
    3,871
    This is just because expression on right returns value something larger than BYTE/char. You can safely remove (in given case) and it will work fine except compiler warinings!
    My latest article: Explicating the new C++ standard (C++0x)

    Do rate the posts you find useful.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured