SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Showing crypting technique using Cesar's ROT-13 Algorithm



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Programming Techniques | Приемы программирования
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1636

PostPosted: Mon Feb 25, 2008 1:37 pm    Post subject: Showing crypting technique using Cesar's ROT-13 Algorithm Reply with quote

Code:
report zexp_rot13 no standard page heading line-size 100.
***********************************************************
* Showing simple crypting technique using Cesar's ROT-13 Algorithm
*
*   This is freeware. Please read the terms of use.
*   Written by Urs Rohner, Rohner IT Consulting & Engineering
*
*   Contact Author: Urs Rohner
*
* History
*
*  Vers  Date                Own  Remarks
*  ----  ------------------  ---  --------------------------------------
*  1.00  26th February 2001  rnr  Initial version
*  1.01  30th August   2001  rnr  Minor changes
*
***********************************************************

  parameters:
    _t(100) type c lower case default
      'The quick brown fox jumps over the lazy Dog. 26th February 2001'.


* Method: m_crypt>
* Crypt a string using Ceasar's Rot-13 Algorithm, Digits by Rot-5
* Additionally, characters are swapped (1st to Last)
  define m_crypt>.
    perform m_crypt using &1.
  end-of-definition.

  form m_crypt using t_.
    data:
      _c type c,
      _i type i,
      _l type i,
      _a type i,
      _o type i.

    describe field t_ type _c.
    if _c eq 'C'. " crypt only on character fields
      " swap string
      _l = strlen( t_ ).
      _i = _l div 2.
      do _i times.
        _a = sy-index - 1.
        _o = _l - sy-index.
        " swap char
        _c = t_+_a(1).
        t_+_a(1) = t_+_o(1).
        t_+_o(1) = _c.
      enddo.
      " do ROT-13/ROT-5 cryption
      translate t_ using
        'ANBOCPDQERFSGTHUIVJWKXLYMZNAOBPCQDRESFTGUHVIWJXKYLZM' &
        'anbocpdqerfsgthuivjwkxlymznaobpcqdresftguhviwjxkylzm' &
        '05162738495061728394'.
    endif.
  endform.


*
* P A I ( )
*
  start-of-selection.
    write /  _t.
    m_crypt> _t.
    write /  _t.
    m_crypt> _t.
    write /  _t.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Programming Techniques | Приемы программирования All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.