Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 787773
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T21:15:31+00:00 2026-05-14T21:15:31+00:00

Does anyone know the difference between mcrypt_generic and mcrypt_encrypt when it comes to encryption

  • 0

Does anyone know the difference between mcrypt_generic and mcrypt_encrypt when it comes to encryption in PHP?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T21:15:32+00:00Added an answer on May 14, 2026 at 9:15 pm

    mcrypt_encrypt() combines the functionality of several methods, whereas mcrypt_generic() must be called within a certain sequence of other mcrypt_* calls. You would use mcrypt_generic() if you needed the flexibility of the lower-level API, whereas mcrypt_encrypt() acts as a higher-level utility.

    This example in the PHP documentation shows a good comparison between the two API approaches. It refers to mcrypt_ecb(), but for the purposes of this comparison you can consider it to be similar to mcrypt_encrypt().

    From http://us.php.net/manual/en/mcrypt.examples.php

    $key = "this is a secret key";
    $input = "Let us meet at 9 o'clock at the secret place.";
    
    $encrypted_data = mcrypt_ecb (MCRYPT_3DES, $key, $input, MCRYPT_ENCRYPT);
    

    Or:

    $key = "this is a secret key";
    $input = "Let us meet at 9 o'clock at the secret place.";
    
    $td = mcrypt_module_open('tripledes', '', 'ecb', '');
    $iv = mcrypt_create_iv (mcrypt_enc_get_iv_size($td), MCRYPT_RAND);
    mcrypt_generic_init($td, $key, $iv);
    $encrypted_data = mcrypt_generic($td, $input);
    mcrypt_generic_deinit($td);
    mcrypt_module_close($td);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone know the difference between the orientation sensor and magnetic field sensor on
does anyone know the difference between these two assemblies? Is the web assembly just
I want to understand the difference between composition and aggregation relationship. Does anyone know
Does anyone know how to enable blending in OpenGL (android) on a HTC Desire.
What is the difference between ResultSetMetaData.getColumnLabel and ResultSetMetaData.getColumnName ? Label: Gets the designated column's
I'm having a strange issue with counting form elements in jQuery. While I can
According to MySql in this document C.7.9.6. Changes in MySQL Connector/NET 5.0.5 (07 March
I just put together a small script for a team of users that collects
For some reason, I cannot get a UIWebView to play nice with my new
If you read about cmpthese in the Perl Benchmark module's documentation, it states that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.