0
$\begingroup$

I have to to find the shift value and the message for the following caesar cipher. OC_VAWDGPM_VHWTVX_VXJOCVZ_GDX_MWO_VWIZVYGWIZ_NODI_

I have already tried it and with the shift value of 21 i get the following. TH_AFBILUR_AMBYAC_ACOTHAE_LIC_RBT_ABNEADLBNE_STIN_

Does this look like the correct decrypted message to anyone?
How am i supposed to determine the correct answer? I think I'm doing something wrong

Here are all the possible decryptions:

  1. NB_UZVCFOL_UGVSUW_UWINBUY_FCW_LVN_UVHYUXFVHY_MNCH_
  2. MA_TYUBENK_TFURTV_TVHMATX_EBV_KUM_TUGXTWEUGX_LMBG_
  3. LZ_SXTADMJ_SETQSU_SUGLZSW_DAU_JTL_STFWSVDTFW_KLAF_
  4. KY_RWSZCLI_RDSPRT_RTFKYRV_CZT_ISK_RSEVRUCSEV_JKZE_
  5. JX_QVRYBKH_QCROQS_QSEJXQU_BYS_HRJ_QRDUQTBRDU_IJYD_
  6. IW_PUQXAJG_PBQNPR_PRDIWPT_AXR_GQI_PQCTPSAQCT_HIXC_
  7. HV_OTPWZIF_OAPMOQ_OQCHVOS_ZWQ_FPH_OPBSORZPBS_GHWB_
  8. GU_NSOVYHE_NZOLNP_NPBGUNR_YVP_EOG_NOARNQYOAR_FGVA_
  9. FT_MRNUXGD_MYNKMO_MOAFTMQ_XUO_DNF_MNZQMPXNZQ_EFUZ_
  10. ES_LQMTWFC_LXMJLN_LNZESLP_WTN_CME_LMYPLOWMYP_DETY_
  11. DR_KPLSVEB_KWLIKM_KMYDRKO_VSM_BLD_KLXOKNVLXO_CDSX_
  12. CQ_JOKRUDA_JVKHJL_JLXCQJN_URL_AKC_JKWNJMUKWN_BCRW_
  13. BP_INJQTCZ_IUJGIK_IKWBPIM_TQK_ZJB_IJVMILTJVM_ABQV_
  14. AO_HMIPSBY_HTIFHJ_HJVAOHL_SPJ_YIA_HIULHKSIUL_ZAPU_
  15. ZN_GLHORAX_GSHEGI_GIUZNGK_ROI_XHZ_GHTKGJRHTK_YZOT_
  16. YM_FKGNQZW_FRGDFH_FHTYMFJ_QNH_WGY_FGSJFIQGSJ_XYNS_
  17. XL_EJFMPYV_EQFCEG_EGSXLEI_PMG_VFX_EFRIEHPFRI_WXMR_
  18. WK_DIELOXU_DPEBDF_DFRWKDH_OLF_UEW_DEQHDGOEQH_VWLQ_
  19. VJ_CHDKNWT_CODACE_CEQVJCG_NKE_TDV_CDPGCFNDPG_UVKP_
  20. UI_BGCJMVS_BNCZBD_BDPUIBF_MJD_SCU_BCOFBEMCOF_TUJO_
  21. TH_AFBILUR_AMBYAC_ACOTHAE_LIC_RBT_ABNEADLBNE_STIN_
  22. SG_ZEAHKTQ_ZLAXZB_ZBNSGZD_KHB_QAS_ZAMDZCKAMD_RSHM_
  23. RF_YDZGJSP_YKZWYA_YAMRFYC_JGA_PZR_YZLCYBJZLC_QRGL_
  24. QE_XCYFIRO_XJYVXZ_XZLQEXB_IFZ_OYQ_XYKBXAIYKB_PQFK_
  25. PD_WBXEHQN_WIXUWY_WYKPDWA_HEY_NXP_WXJAWZHXJA_OPEJ_
  26. OC_VAWDGPM_VHWTVX_VXJOCVZ_GDX_MWO_VWIZVYGWIZ_NODI_
$\endgroup$

closed as off-topic by Maarten Bodewes, archie, Gilles, poncho, otus Aug 11 '14 at 5:52

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Requests for analyzing or deciphering a block of data are off-topic here, as the results are rarely useful to anyone else." – Maarten Bodewes, archie, Gilles, poncho, otus
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    $\begingroup$ Are you sure that it is a Caesar cipher ? Probably a general substitution cipher ? $\endgroup$ – Thor Aug 10 '14 at 12:26
  • $\begingroup$ It's from a worksheet I have to complete. It specifically said that the given was encrypted with caesars cipher. But i guess they could have made a mistake. @Thor $\endgroup$ – crbon Aug 10 '14 at 12:32
  • 1
    $\begingroup$ Does that underscore represent a sapce or is it part of the alphabet/character set of this cipher? $\endgroup$ – marstato Aug 10 '14 at 15:43
4
$\begingroup$

You are actually doing the right thing, however you do not include the "_" as part of the characterset. Assuming the alphabet consists of 27 letters (A-Z and "_"), and using the appended JavaScript script (you can simply paste it into the console), returns one sentence which actually does make sense:

THE_FAILURE_MAY_BE_BOTH_DELIBERATE_AND_CLANDESTINE

var ciphertext = "OC_VAWDGPM_VHWTVX_VXJOCVZ_GDX_MWO_VWIZVYGWIZ_NODI_";

var alphabet = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","_"];

var rotation = 1;

var cleartext = "";

while (rotation < 27) {
for (var i=0,l=ciphertext.length;i<l;i++) {

  var character = ciphertext[i];

  var index = 0;

  // get the number in the alphabet
  for (var j=0;j<27;j++) {
    if (alphabet[j] === character) {
      index = j;
      break;
    }
  }

  // rotate

  cleartext += alphabet[(index + rotation) % 27];
}

console.log(cleartext);
rotation++;
cleartext = "";
}

EDIT: There is one thing I wanted to add regarding the script above. We are doing $index + rotation \bmod 27$ here because we are trying every possibility. In a strict sense this is another encryption of the ciphertext, only that one rotation must of course result in the cleartext. If $rotation$ is already known and you want to decrypt the cipher using this exact value, you would of course have to calculate $(index - rotation + 27) \bmod 27 $.

$\endgroup$
  • $\begingroup$ 1) Define the alphabet as string and use the indexOf function to simplify your code. 2) You can use a for loop for the rotation 3) Use alphabet.length instead of hardcoding the 27. $\endgroup$ – CodesInChaos Aug 10 '14 at 19:25
  • $\begingroup$ Sure, the code can be improved, it was just a hastily typed script in the browser's console to get the gist. But for generalisation, you're right. $\endgroup$ – johnnycrab Aug 10 '14 at 19:52

Not the answer you're looking for? Browse other questions tagged or ask your own question.