آخـــر الـــمـــشـــاركــــات

تحميل برنامج الغاء تثبيت البرامج من الكمبيوتر Should I Remove It » آخر مشاركة: اردني وافتخر دردشة وتعليله وسواليف.. » آخر مشاركة: عاشق الحصن بريد الاعضاء » آخر مشاركة: محمد العزام اهلا بكم ..رمضان كريم » آخر مشاركة: حسان القضاة شو عم تسمع هلا » آخر مشاركة: حسان القضاة ما هو سبب تواجدك في المنتدى والى اي حدّ يستمر او ينتهي إنتسابك له ؟ » آخر مشاركة: قلعتي أبدية مرحبا » آخر مشاركة: محمد العزام " أميــــرةُ قـوسِ النَّصـــــر" » آخر مشاركة: قلعتي أبدية ~ إبريـــــــــــــــــل ~ » آخر مشاركة: حسان القضاة اسئلة مهمة بالفوتوشوب في المطابع 2019 » آخر مشاركة: المصمم يزن جبريل صاحب المركز الاول فى مجال تنزيل الملفات كامل مدي الحياة IDM 6.32 » آخر مشاركة: siiin همسات وأشوق » آخر مشاركة: حسان القضاة ""أيلـول""... » آخر مشاركة: قلعتي أبدية تبليغ عن رسالة زائر بواسطة راشد مرشد » آخر مشاركة: أميرة قوس النصر اشتقنالكم » آخر مشاركة: Mahmoud Zaben تُراهات ما قبل النوم ... » آخر مشاركة: قلعتي أبدية شو مزاجك اليوم... » آخر مشاركة: قلعتي أبدية قبول بلاغ عطل ثلاجات كلفينيتور 01092279973 & 0235700997 وكيل كلفينيتور (م .الجديدة) » آخر مشاركة: الوكيل1 قبول بلاغ عطل ثلاجات هوفر 01154008110 & 0235699066 وكيل هوفر (م.6اكتوبر) » آخر مشاركة: الوكيل1 قبول بلاغ عطل ثلاجات جنرال اليكتريك 01207619993 & 0235700997 وكيل جنرال اليكتريك (الز » آخر مشاركة: الوكيل1
+ الرد على الموضوع
النتائج 1 إلى 4 من 4

الموضوع: ارجو المساعدة

  1. #1
    عضو مميز الصورة الرمزية الوردة الزرقاء
    تاريخ التسجيل
    Jun 2010
    الدولة
    الكرك
    العمر
    35
    المشاركات
    139

    Icon34z ارجو المساعدة

    بدي كود لخوارزمية التشفير playfairو rail fence طبعا كل وحدة لحالها رجاء الي بيقدر يساعدني يعطيني الحل وشكرا الكم
    كن صديقا ولا تنتظر ان يكون لك صديق

  2. #2
    عضو مؤسس الصورة الرمزية Sc®ipt
    تاريخ التسجيل
    Nov 2008
    الدولة
    There's no place like 127.0.0.1
    العمر
    38
    المشاركات
    4,003

    افتراضي رد: ارجو المساعدة

    الكود بالسي شارب لل playfair

    كود PHP:
    using System;
    using System.Text;

    class 
    Test
    {
        static 
    void Main()
        {
            
    string originalText "Defend the east wall of the castle.";
            
    Console.WriteLine(originalText);        
            
    string plainText Playfair.Prepare(originalText);
            
    Console.WriteLine(plainText);
            
    string key "cdefghiklmnopqrstuvwxyzab"
            
    string cipherText Playfair.Encipher(keyplainText);
            
    Console.WriteLine(cipherText);
            
    plainText Playfair.Decipher(keycipherText);
            
    Console.WriteLine(plainText);
            
    Console.WriteLine();
            
    originalText "Hide the gold in the tree stump.";
            
    Console.WriteLine(originalText);        
            
    plainText Playfair.Prepare(originalText);
            
    Console.WriteLine(plainText);
            
    key "playfirexmbcdghjknostuvwz";    
            
    cipherText Playfair.Encipher(keyplainText);
            
    Console.WriteLine(cipherText);
            
    plainText Playfair.Decipher(keycipherText);
            
    Console.WriteLine(plainText);
            
    Console.ReadLine();
        }
    }

    public class 
    Playfair
    {

        
    /*
            'Prepare' removes all characters that are not letters i.e. all numbers, punctuation,
            spaces etc. are removed (uppercase is also converted to lowercase).

            If the seond letter of a pair is the same as the first letter, an 'x' is inserted.

            Also, if the length of the string is odd, an 'x' is appended to make it an even length
            as Playfair can only encrypt even length strings.

            If you want numbers, punctuation etc. you must spell it out e.g.
            'stop' for period, 'one', 'two' etc.
        */

        
    public static string Prepare(string originalText)
        {
            
    int length originalText.Length;
            
    originalText originalText.ToLower();
            
    StringBuilder sb = new StringBuilder();
        
            for(
    int i 0lengthi++)
            {
               
    char c originalText***91;i***93;;
               if (
    >= 97 && <= 122)
               {
                  
    // If the second letter of a pair is the same as the first, insert an 'x'
                  
    if (sb.Length == && sb***91;sb.Length 1***93; == c)
                  {                                
                     
    sb.Append('x');
                  }
                  
    sb.Append(c);
               }
            }

            
    // If the string is an odd length, append an 'x'
            
    if (sb.Length == 1)
            {
               
    sb.Append('x');
            }
      
            return 
    sb.ToString();    
        }

        
    /*
            'Encipher' uses the Playfair cipher to encipher some text.
            The key is a string containing all 26 letters in the alphabet, except one'.
        */
        
    public static string Encipher(string keystring plainText)
        {
            
    int length plainText.Length;
            
    char a,b;  
            
    int a_indb_inda_rowb_rowa_colb_col;  
            
    StringBuilder sb = new StringBuilder();
        
            for(
    int i 0lengthi+=2)
            {
               
    plainText***91;i***93;;
               
    plainText***91;i+1***93;;
           
               
    a_ind key.IndexOf(a);
               
    b_ind key.IndexOf(b);
               
    a_row a_ind 5;
               
    b_row b_ind 5;
               
    a_col a_ind 5;
               
    b_col b_ind 5;

               if(
    a_row == b_row)
               {
                  if(
    a_col == 4)
                  {
                      
    sb.Append(key***91;a_ind 4***93;);
                      
    sb.Append(key***91;b_ind 1***93;);
                  }
                  else if(
    b_col == 4)
                  {
                      
    sb.Append(key***91;a_ind 1***93;);
                      
    sb.Append(key***91;b_ind 4***93;);
                  }
                  else
                  {
                      
    sb.Append(key***91;a_ind 1***93;);
                      
    sb.Append(key***91;b_ind 1***93;);
                  }
                }
                else if(
    a_col == b_col)
                {
                  if(
    a_row == 4)
                  {
                      
    sb.Append(key***91;a_ind 20***93;);
                      
    sb.Append(key***91;b_ind 5***93;);
                  }
                  else if(
    b_row == 4)
                  {
                      
    sb.Append(key***91;a_ind 5***93;);
                      
    sb.Append(key***91;b_ind 20***93;);
                  }
                  else
                  {
                      
    sb.Append(key***91;a_ind 5***93;);
                      
    sb.Append(key***91;b_ind 5***93;);
                  }
               }
               else
               {
                   
    sb.Append(key***91;5*a_row b_col***93;);
                   
    sb.Append(key***91;5*b_row a_col***93;);
               }      
            }
            return 
    sb.ToString();
        }


        
    /*
            'Decipher' uses the Playfair cipher to decipher some text.
            The key is a string containing all 26 letters of the alphabet, except one.
        */
        
    public static string Decipher(string keystring cipherText)
        {
            
    int length cipherText.Length;
            
    char a,b;  
            
    int a_indb_inda_rowb_rowa_colb_col;  
            
    StringBuilder sb = new StringBuilder();
        
            for(
    int i 0lengthi+=2)
            {
               
    cipherText***91;i***93;;
               
    cipherText***91;i+1***93;;
           
               
    a_ind key.IndexOf(a);
               
    b_ind key.IndexOf(b);
               
    a_row a_ind 5;
               
    b_row b_ind 5;
               
    a_col a_ind 5;
               
    b_col b_ind 5;

               if(
    a_row == b_row)
               {
                  if(
    a_col == 0)
                  {
                      
    sb.Append(key***91;a_ind 4***93;);
                      
    sb.Append(key***91;b_ind 1***93;);
                  }
                  else if(
    b_col == 0)
                  {
                      
    sb.Append(key***91;a_ind 1***93;);
                      
    sb.Append(key***91;b_ind 4***93;);
                  }
                  else
                  {
                      
    sb.Append(key***91;a_ind 1***93;);
                      
    sb.Append(key***91;b_ind 1***93;);
                  }
                }
                else if(
    a_col == b_col)
                {
                  if(
    a_row == 0)
                  {
                      
    sb.Append(key***91;a_ind 20***93;);
                      
    sb.Append(key***91;b_ind 5***93;);
                  }
                  else if(
    b_row == 0)
                  {
                      
    sb.Append(key***91;a_ind 5***93;);
                      
    sb.Append(key***91;b_ind 20***93;);
                  }
                  else
                  {
                      
    sb.Append(key***91;a_ind 5***93;);
                      
    sb.Append(key***91;b_ind 5***93;);
                  }
               }
               else
               {
                   
    sb.Append(key***91;5*a_row b_col***93;);
                   
    sb.Append(key***91;5*b_row a_col***93;);
               }      
            }
            return 
    sb.ToString();
        }

    الكود بالسي شارب rail fence


    كود PHP:
    /// <summary>
    /// method for demonstrating the ZigZag Cipher 
    /// (Also known as the Rail Fence Cipher)
    /// </summary>
    /// <param name="str">string we wish to apply the cipher to</param>
    /// <returns>the ciphered string</returns>
    public static string ZigZagCipher(string str)
    {
        
    //create zip & zag (we're only using
        //2 rails so this represents top and bottom rails)
        
    string zig "";
        
    string zag "";

        
    //convert the input string to a char array
        
    char***91;***93chrArray str.ToCharArray();

        
    //this lets us know if we're dealing with the
        //top or bottom rail
        
    bool isTopRow true;

        
    //loop through the char array
        
    foreach (char c in chrArray)
        {
            
    //if we're dealing with the top rail add
            //current char to zig
            
    if (isTopRow == true)
                
    zig += c.ToString();
            else
                
    //otherwise add to zag
                
    zag += c.ToString();

            
    //change status
            
    isTopRow = !isTopRow;
        }

        
    //concantenate the 2 and return
        
    return zig zag;
    }

    /// <summary>
    /// method for undoing the zigzag cipher
    /// </summary>
    /// <param name="str">the string we're working with</param>
    /// <returns>the converted string</returns>
    public static string DecipherZigZag(string str)
    {
        
    //create zig & zag which both hold 1/2 the original string
        
    string zig str.Substring(0str.Length 2);
        
    string zag str.Substring(str.Length 2);

        
    //top & bottom counter to hold our position
        
    int top 0;
        
    int bottom 0;

        
    //hold the deciphered string
        
    string decyphered "";
        
    bool isTopRow true;

        
    //loop through the string, making sure we havent gone too far
        
    while (decyphered.Length != str.Length)
        {
            
    //if we're dealing with the top rail then add to
            //deciphered from the zig char array
            
    if (isTopRow == true)
            {
                
    decyphered += zig.Substring(top1);
                
    top++;
            }
            else
            {
                
    //otherwise add from the zag char array
                
    decyphered += zag.Substring(bottom1);
                
    bottom++;
            }
            
    isTopRow = !isTopRow;
        }
        return 
    decyphered;

    ملاحظة : الكود من النت و مش برمجتي ,, يرجى فحصه و عمل Test قبل تسليمة للأستاذ حمدي العمري

    ملاحظة ثانية : الرمز 93*** الي ظاهر بالكود هو رمز المصفوفة المربعة [ و ] لكن لخطأ معين بالعرض بالمنتدى ما ظهر
    التعديل الأخير تم بواسطة Sc®ipt ; 03-01-2011 الساعة 12:01 AM

  3. #3
    عضو مميز الصورة الرمزية الوردة الزرقاء
    تاريخ التسجيل
    Jun 2010
    الدولة
    الكرك
    العمر
    35
    المشاركات
    139

    افتراضي رد: ارجو المساعدة

    شكرا كتييييييييييييييييييير ع المساعدة غلبتك معي
    كن صديقا ولا تنتظر ان يكون لك صديق

  4. #4
    عضو مؤسس الصورة الرمزية Sc®ipt
    تاريخ التسجيل
    Nov 2008
    الدولة
    There's no place like 127.0.0.1
    العمر
    38
    المشاركات
    4,003

    افتراضي رد: ارجو المساعدة

    العفو ,, نورتي

+ الرد على الموضوع

معلومات الموضوع

الأعضاء الذين يشاهدون هذا الموضوع

الذين يشاهدون الموضوع الآن: 1 (0 من الأعضاء و 1 زائر)

المواضيع المتشابهه

  1. ارجو المساعدة
    بواسطة safa2 في المنتدى التوجيهي الاردني
    مشاركات: 0
    آخر مشاركة: 07-31-2010, 05:25 PM
  2. مشاركات: 24
    آخر مشاركة: 04-07-2010, 01:19 PM
  3. ارجو المساعدة وشكرا للكل
    بواسطة ابن العطار في المنتدى أخبار التكنولوجيا وجديد الحاسوب
    مشاركات: 2
    آخر مشاركة: 10-10-2009, 09:21 PM
  4. بحبك يا اردن
    بواسطة mylife079 في المنتدى نحبك يا أردن
    مشاركات: 6
    آخر مشاركة: 09-23-2008, 01:08 PM

الكلمات الدلالية لهذا الموضوع

مواقع النشر (المفضلة)

مواقع النشر (المفضلة)

ضوابط المشاركة

  • لا تستطيع إضافة مواضيع جديدة
  • تستطيع الرد على المواضيع
  • لا تستطيع إرفاق ملفات
  • لا تستطيع تعديل مشاركاتك
  •