How to get the fixed result in a DES/CBC mode with fixed input data and fix

How to get the fixed result in a DES/CBC mode with fixed input data and fixed key. Below is my program , I tried to get the checksum of the DESInputData with the DESKeyData, but each time the result is different.
below is my code:
byte[] DESKeyData = {(byte)0x01 ,(byte)0x01 ,(byte)0x01 ,(byte)0x01, (byte)0x01 ,(byte)0x01 ,(byte)0x01 ,(byte)0x01 };
byte[] DESInputData = {(byte)0x31 ,(byte)0x31 ,(byte)0x31 ,(byte)0x31,(byte)0x31 ,(byte)0x31 ,(byte)0x31 ,(byte)0x31 };
SecretKeySpec skey = new SecretKeySpec( DESKeyData, "DES" );
Cipher cipher = Cipher.getInstance("DES/CBC/NoPadding");
cipher.init( Cipher.ENCRYPT_MODE, skey );
byte[] result = cipher.doFinal( DESInputData );

Use class javax.crypto.spec.IvParameterSpec to specify IV for CBC mode cipher:
// Create CBC-mode triple-DES cipher.
Cipher c = Cipher.getInstance("DESede/CBC/PKCS5Padding");
// Specify IV.
IvParameterSpec iv = new IvParameterSpec(new byte[] { (byte)0x01, (byte)0x23, (byte)0x45, (byte)0x67, (byte)0x89, (byte)0xAB, (byte)0xCD, (byte)0xEF });
// Initialize cipher with proper IV.
c.init(Cipher.ENCRYPT_MODE, yourKey, iv);
// Encrypt and decrypt should work ok now.
For more info about cryptography, search the Internet for IntroToCrypto.pdf from mr. Phil Zimmerman. This document is also part of PGP (http://www.pgp.com).
An excellent book is 'Applied Cryptography' from Bruce Schneier (http://www.counterpane.com/applied.html).
Regards,
Ronald Maas

Similar Messages

  • Whenever I run Firfox 4.0, my computer fan runs continuously. I have disabled all plug-ins, and I get the same result. This did not happen with Firefox 3.x, and it doesn't happen with IE 8.0. Any ideas?

    Whenever I run Firfox 4.0, my computer fan runs continuously. I have disabled all Firefox plug-ins, but I get the same result. This did not happen with Firefox 3.x, and it doesn't happen with IE 8.0. Any ideas?

    I have had a similar problem with my system. I just recently (within a week of this post) built a brand new desktop. I installed Windows 7 64-bit Home and had a clean install, no problems. Using IE downloaded an anti-virus program, and then, because it was the latest version, downloaded and installed Firefox 4.0. As I began to search the internet for other programs to install after about maybe 10-15 minutes my computer crashes. Blank screen (yet monitor was still receiving a signal from computer) and completely frozen (couldn't even change the caps and num lock on keyboard). I thought I perhaps forgot to reboot after an update so I did a manual reboot and it started up fine.
    When ever I got on the internet (still using firefox) it would crash after anywhere between 5-15 minutes. Since I've had good experience with FF in the past I thought it must be either the drivers or a hardware problem. So in-between crashes I updated all the drivers. Still had the same problem. Took the computer to a friend who knows more about computers than I do, made sure all the drivers were updated, same problem. We thought that it might be a hardware problem (bad video card, chipset, overheating issues, etc.), but after my friend played around with my computer for a day he found that when he didn't start FF at all it worked fine, even after watching a movie, or going through a playlist on Youtube.
    At the time of this posting I'm going to try to uninstall FF 4.0 and download and install FF 3.6.16 which is currently on my laptop and works like a dream. Hopefully that will do the trick, because I love using FF and would hate to have to switch to another browser. Hopefully Mozilla will work out the kinks with FF 4 so I can continue to use it.
    I apologize for the lengthy post. Any feedback would be appreciated, but is not necessary. I will try and post back after I try FF 3.16.6.

  • How to get the query result of improvement (Before and After ) using sql de

    how to get the query result of improvement (Before and After ) using sql developer.

    Check
    http://www.oracle.com/technetwork/articles/sql/exploring-sql-developer-1637307.html

  • How to get the full result of a google search?

    How to get the full results of a google search?
    Nov 23, 2006 2:28 AM
    Hi, Friends,
    I want to build a URL collector as a seamless and integrated part of my desktop application in java language which can access the full search results of google, but i am not sure the right way? what is the best way to do that in java?
    Where to find the relevant materials for the problem?
    thanks a lot

    Cross post - http://forum.java.sun.com/thread.jspa?threadID=788627&messageID=4481369#4481369

  • After installing iOS6, my Maps are not working at all, anything i search it says "result not found" even after placing a pin and selecting "Direction to here" i get the same result not found. Very disappointed with the new iOS

    After installing iOS6, my Maps are not working at all, anything i search it says "result not found" even after placing a pin and selecting "Direction to here" i get the same result not found. Very disappointed with the new iOS.

    Have you run it in a debugger? That will show you exactly what is happening and why.

  • How to get the best results using the refine edge tool?

    how to use the sliders in the refine edge tool? how do you get the best results using the fine edge tool?

    You should ask in the forum for the (un-named) program you are using
    The Cloud forum is not about using individual programs
    The Cloud forum is about the Cloud as a delivery & install process
    If you will start at the Forums Index https://forums.adobe.com/welcome
    You will be able to select a forum for the specific Adobe product(s) you use
    Click the "down arrow" symbol on the right (where it says All communities) to open the drop down list and scroll

  • How to get  the Overall result and Avg in Query

    Hi
    I am facing a problem to find Overall result and Avg for the keyfigure.
    Here is the scenario.
    I have a fiscalperiod ,qty in query column and material in row, when user enters the fiscalperiod(004.2006 to 006.2006)
    the output should come as
       0406 0506 0606  Avg
    M1  10  20   40     35
    M2  20  40   30     45
    res 30  60  70
    i can able to get the overall result not avg,
    if i change the properities of keyfigure 'Calicuate Result as 'Average of all values'',then i am loosing the overall result.
    eitherway i can able to get one result,not both.
    anybody can help.
    Thanks
    Madhu

    You have 2 key figures and you have put Material in the ROWS.
    Remove Material from ROWS and instead use 0FISCYEAR in the row selection.
    You can create 12 Key figures for each month and use either Filer or Free Characteristic using 0CALMONTH to restrict the month for the selection Variable.
    For the Key Figures use "Calculate Single Value as" Average.
    Create another formula as KF1KF2....+KF12 to get the sum of average.
    Regs
    Gopi
    Assign points if it helps...

  • How to get the required result in BI publisher?

    Hi All,
    QuoteROW
       QuoteItemROW
        SA   -- abc   
        PROD --xyzitem
        NR     -- 100
        MR     -- 150
                 QuoteItemROW
                       SA   -- abc   
                       PROD --xyz
                       NR     -- 100
                       MR     -- 150
                  QuoteItemROW
                       SA   -- abc   
                       PROD --xyz
                       NR     -- 100
                       MR     -- 150
      QuoteItemROW
        SA   -- abc   
        PROD --xyzitem
        NR     -- 100
        MR     -- 150
                  QuoteItemROW
                      SA   -- abc   
                      PROD --xyz
                      NR     -- 100
                      MR     -- 150
                   QuoteItemROW
                      SA   -- abc   
                      PROD --xyz
                      NR     -- 100
                      MR     -- 150
        QuoteItemROW
      SA   -- abc   
      PROD --klmitem
      NR     -- 100
      MR     -- 150
                  QuoteItemROW
                     SA   -- abc   
                      PROD --xyz
                      NR     -- 100
                      MR     -- 150
                  QuoteItemROW
                      SA   -- abc   
                      PROD --klm
                      NR     -- 100
                      MR     -- 150
    I have to grp on SA, PROD, NR, MR
    My Result should be a table
    SA ---abc
    PROD               NR           MR                 count
    xyzitem               100         150                    2
        xyz                  100         150                   4
    klmitem               100          150                   1
         xyz                 100          150                  1
         klm                 100          150                  1
    Please let me know how to get cnt on child record.
    Regards,
    Sam

    Hi Alex, thank you for your reply.
    Yes that is the hierarchy,
    QuoteItemROW -------------------------------------> this is the main POFS (master)
        SA  -- abc 
        PROD --xyzitem
        NR    -- 100
        MR    -- 150
        QTY  --  1
                QuoteItemROW ----------------------------this is POES under POFS (child)
                      SA  -- abc 
                      PROD --xyz
                      NR    -- 100
                      MR    -- 150
                      QTY  ---- 1
    and required a group on SA, then PROD, NR and MR. Basically wanted to display QTY count/sum.
    xyz is repeating (in red color) because first xyz is under group of xyzitem and another xyz is under another group of klmitem.
    SA ---abc
    PROD              NR          MR                QTY
    xyzitem              100        150                    2
       xyz                  100        150                  4
    klmitem              100          150                  1
       xyz                100          150                  1
        klm                100          150                  1
    Regards,
    Sam

  • How to get the Survey result with a External Provider

    Hi all
    We have an scenario where we create a Survey and it's executed for a third party, and then they send to us the results for example in a excel sheet.
    Some know how we can upload the survey results per each client into CRM,
    Best Regards.

    Go for ELM processing.....create mapping and ELM the file in the system....In the BADI enhancement for processing steps, define the logic for processing the response through an activity....
    Create Activity
    Attach the questionaire to the Activity...
    ELM the file that you received
    Process the file filling up answers on the activity questionaire...
    Hope it helps...
    Thanks
    Nikhil

  • How to get the entire result into an XMLDocument??

    Hello,
    I would like to get the result of a DB Query as XMLDocument. Here's the code I use:
    ResultSet rset = stmt.executeQuery();
    OracleResultSet orset = (OracleResultSet) rset;
    while (orset.next()) {
    XMLType poxml = XMLType.createXML(orset.getOPAQUE(1));
    Document doc = poxml.getDOM();
    The problem is, that I can only get a XMLDocument per table row, but not an XMLDocument of the entire result.
    Regards,
    Dominik

    I got the answer myself:
    In the xsql-query, use the xmlagg() function to group the all records into one record.
    Use the same Java code.
    Regards,
    Dominik

  • How to get the total time spent by a Portal User for a given Date?

    Hello,
    We need to develop a Daily Audit Track Report that displays
    the Users logged into our System for a given day and the total login duration in Hours( should include all the
    Login-Logouts of a given date).
    While Portal30_SSO.WWSSO_AUDIT_LOG_TABLE$ can help me get the Users login to Portal for a day, there is no Login/Logout periods in it.
    Any help would be appreciated.
    Thanks
    Madhav

    You may want to consult with the view WWLOG_ACTIVITY_LOGS. Not sure how your environment is configured, but ours includes two WWLOG_ACTIVITY_LOG tables (1 & 2). These tables purge themselves based on your configuration. In other words, Portal will log activity in WWLOG_ACTIVITY_LOG1$ for a certain period of time, then switch to WWLOG_ACTIVITY_LOG2$ while purging the first one. You can specify the purge timetable in the Adminster tab of the Admin page (under Global Settings). If you just key on just 1 log table, you're logs may someday go blank.
    The actions used are 'login' and 'logout'. You can link the actions using the key_1 and key_2 columns of the view. From our current experience, Portal does not account for users that simply close the browser. In other words, we have not been able to get a log event for the action 'logout' for the same key_2 value if someone does this.

  • How to get the current session details in windows phone 8 when using Facebook ,Google and Microsoft login

    I want to get the session details like access token , provider etc on a page (ExamplePage.xaml.cs) , i used the following example from nokia developers community (link)
     and implemented the login part but how can i get session details  so that i can send it to my API
    The SessionService class manages the session on facebook,google,microsoft login:
    /// <summary>
    /// The service session.
    /// </summary>
    public class SessionService : ISessionService
    private readonly IApplicationSettingsService _applicationSettings;
    private readonly IFacebookService _facebookService;
    private readonly IMicrosoftService _microsoftService;
    private readonly IGoogleService _googleService;
    private readonly ILogManager _logManager;
    /// <summary>
    /// Initializes a new instance of the <see cref="SessionService" /> class.
    /// </summary>
    /// <param name="applicationSettings">The application settings.</param>
    /// <param name="facebookService">The facebook service.</param>
    /// <param name="microsoftService">The microsoft service.</param>
    /// <param name="googleService">The google service.</param>
    /// <param name="logManager">The log manager.</param>
    public SessionService(IApplicationSettingsService applicationSettings,
    IFacebookService facebookService,
    IMicrosoftService microsoftService,
    IGoogleService googleService, ILogManager logManager)
    _applicationSettings = applicationSettings;
    _facebookService = facebookService;
    _microsoftService = microsoftService;
    _googleService = googleService;
    _logManager = logManager;
    /// <summary>
    /// Gets the session.
    /// </summary>
    /// <returns>The session object.</returns>
    public Session GetSession()
    var expiryValue = DateTime.MinValue;
    string expiryTicks = LoadEncryptedSettingValue("session_expiredate");
    if (!string.IsNullOrWhiteSpace(expiryTicks))
    long expiryTicksValue;
    if (long.TryParse(expiryTicks, out expiryTicksValue))
    expiryValue = new DateTime(expiryTicksValue);
    var session = new Session
    AccessToken = LoadEncryptedSettingValue("session_token"),
    Id = LoadEncryptedSettingValue("session_id"),
    ExpireDate = expiryValue,
    Provider = LoadEncryptedSettingValue("session_provider")
    _applicationSettings.Set(Constants.LoginToken, true);
    _applicationSettings.Save();
    return session;
    /// <summary>
    /// The save session.
    /// </summary>
    /// <param name="session">
    /// The session.
    /// </param>
    private void Save(Session session)
    SaveEncryptedSettingValue("session_token", session.AccessToken);
    SaveEncryptedSettingValue("session_id", session.Id);
    SaveEncryptedSettingValue("session_expiredate", session.ExpireDate.Ticks.ToString(CultureInfo.InvariantCulture));
    SaveEncryptedSettingValue("session_provider", session.Provider);
    _applicationSettings.Set(Constants.LoginToken, true);
    _applicationSettings.Save();
    /// <summary>
    /// The clean session.
    /// </summary>
    private void CleanSession()
    _applicationSettings.Reset("session_token");
    _applicationSettings.Reset("session_id");
    _applicationSettings.Reset("session_expiredate");
    _applicationSettings.Reset("session_provider");
    _applicationSettings.Reset(Constants.LoginToken);
    _applicationSettings.Save();
    /// <summary>
    /// The login async.
    /// </summary>
    /// <param name="provider">
    /// The provider.
    /// </param>
    /// <returns>
    /// The <see cref="Task"/> object.
    /// </returns>
    public async Task<bool> LoginAsync(string provider)
    Exception exception = null;
    try
    Session session = null;
    switch (provider)
    case Constants.FacebookProvider:
    session = await _facebookService.LoginAsync();
    break;
    case Constants.MicrosoftProvider:
    session = await _microsoftService.LoginAsync();
    break;
    case Constants.GoogleProvider:
    session = await _googleService.LoginAsync();
    break;
    if (session != null)
    Save(session);
    return true;
    catch (InvalidOperationException e)
    throw;
    catch (Exception ex)
    exception = ex;
    await _logManager.LogAsync(exception);
    return false;
    /// <summary>
    /// The logout.
    /// </summary>
    public async void Logout()
    Exception exception = null;
    try
    var session = GetSession();
    switch (session.Provider)
    case Constants.FacebookProvider:
    _facebookService.Logout();
    break;
    case Constants.MicrosoftProvider:
    _microsoftService.Logout();
    break;
    case Constants.GoogleProvider:
    _googleService.Logout();
    break;
    CleanSession();
    catch (Exception ex)
    exception = ex;
    if (exception != null)
    await _logManager.LogAsync(exception);
    /// <summary>
    /// Loads an encrypted setting value for a given key.
    /// </summary>
    /// <param name="key">
    /// The key to load.
    /// </param>
    /// <returns>
    /// The value of the key.
    /// </returns>
    private string LoadEncryptedSettingValue(string key)
    string value = null;
    var protectedBytes = _applicationSettings.Get<byte[]>(key);
    if (protectedBytes != null)
    byte[] valueBytes = ProtectedData.Unprotect(protectedBytes, null);
    value = Encoding.UTF8.GetString(valueBytes, 0, valueBytes.Length);
    return value;
    /// <summary>
    /// Saves a setting value against a given key, encrypted.
    /// </summary>
    /// <param name="key">
    /// The key to save against.
    /// </param>
    /// <param name="value">
    /// The value to save against.
    /// </param>
    /// <exception cref="System.ArgumentOutOfRangeException">
    /// The key or value provided is unexpected.
    /// </exception>
    private void SaveEncryptedSettingValue(string key, string value)
    if (!string.IsNullOrWhiteSpace(key) && !string.IsNullOrWhiteSpace(value))
    byte[] valueBytes = Encoding.UTF8.GetBytes(value);
    // Encrypt the value by using the Protect() method.
    byte[] protectedBytes = ProtectedData.Protect(valueBytes, null);
    _applicationSettings.Set(key, protectedBytes);
    _applicationSettings.Save();

    I need to get the session details in the following page AllEvents.xaml.cs  :
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Net;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Navigation;
    using Microsoft.Phone.Controls;
    using Microsoft.Phone.Shell;
    using AuthenticationSample.WP80.ViewModel;
    using AuthenticationSample.WP80.Services.Model;
    using AuthenticationSample.WP80.Services;
    using AuthenticationSample.WP80.Resources;
    using System.Threading.Tasks;
    namespace AuthenticationSample.WP80.Views
    public partial class AllEvents : PhoneApplicationPage
    public AllEvents()
    InitializeComponent();
    MainViewModels FakeData = new MainViewModels();
    FakeData.LoadData();
    DataContext = FakeData;

  • How to get the number of routes in MLS L3SW table with SNMP

    Hello experts,
    Is there any way to get the number of routes in the MLS-hardware Layer 3-switching table with SNMP, like with CLI command "show mls cef summary"?
    If possible, please let me know the OID and which MIB do I use.
    [e.g.]
    #show mls cef summary
    Total routes: 400000
    <omit>
    ====
    Device : C6509E
    IOS : s72033-advipservicesk9_wan-mz.122-33.SXH3a.bin
    ====
    Thank you,

    function buttonClick()
    var table = profileTable;
    var lnRow = table.rows.length;
    var insertedRow = table.insertRow(parseFloat(lnRow));
    var cell1 = insertedRow.insertCell();
    cell1.innerHTML ="<tr><td><Input type=\"hidden\" >>>name=\"rowNum\" value="+cnt"+></td></tr>";
    document.profileform.submit;
    on submit it goes to the second page, but the value i got using >>>System.out.println("row number from text >>>box"+request.getParameter("rowNum")); is null. What is wrong with >>>my coding. Can anyone solve this.HI carry
    Check the value of bold data
    function buttonClick()
    var table = profileTable;
    var lnRow = table.rows.length;
    var insertedRow = table.insertRow(parseFloat(lnRow));var cnt=inRow
    var cell1 = insertedRow.insertCell();
    cell1.innerHTML ="<tr><td><Input type=\"hidden\" >>>name=\"rowNum\" value="+cnt+"></td></tr>";
    document.profileform.submit;
    }try with it

  • How to get the query result !

    Experts !
    i am working on a query. in this query i have a sales for a sales person for a month, and in the 2nd coulmn sales for the previous month. there is a 3rd column which gives (% change ). now i have to show only those records where (% change ) is more / less 34%. how do i get those ? Exceptions ??
    If by using exceptions, then the 3rd column ( % change) is a formula column ( Not the key figure) . can i use exceptions on Formula column ?
    Please help

    HI ,
    You can try this by creating a condition ,
    Create a new condition, in keyfigure you can choose the formula for %, choose  the operator as Greater than , in values give 34
    Regards,
    Sathya

  • How to get the correct result when I access mxml file in address bar in IE?

    os: windows xp
    web server: tomcat 5.5
    lcds version: 2.6
    One week ago, I installed lcds2.5 in my coumputer. At that time, when I type address http://localhost/lcds/test.mxml in address bar of Internet Explorer, the web server return the result of test.swf.
    I upgraded lcds from 2.5 to 2.6 this morning, and then when I type http://localhost/lcds/test.mxml in IE address bar again, the server return the source code of text.mxml in the web page, which is not I expected.
    Why the web server don't handle the *.mxml file like in lcds2.5? How can I resolve this problem?

    Hi,
    Webtier Compiler is which is no longer part of LCDS starting with the version 2.6. However you can install it if you want, read the instructions from this link http://labs.adobe.com/wiki/index.php/LiveCycle_Data_Services:Setting_up_an_SDK,_Compilers ,_and_Flex_Builder

Maybe you are looking for