Pages

Monday, August 22, 2016

Episode 497: Variations of Data Processing at Automated Step (Part 4)

  • Instruction manual sentences that described in multiple language
  • Manuscripts of Website (HTML)
  • Source codes

A Creation flow for these drafts ought to be devised to record (not only "Number of characters", also) "Hash value" automatically.

A Hash value is a "Message digest". It is also referred to as "fingerprint". In short, it generates "32 of hexadecimal characters" (in the case of MD5 method) from any data instantly, allowing to validate data falsification of even a single character. (For more details, please see Wikipedia, etc.)

In the following workflow, [Auto-steps](Service Task) of "Hash generation (MD5)" and "Hash generation (SHA256)" have been arranged. Both of them will be available when you conduct feature expansion with [Addon XML]. (Questetra BPM Suite v11.1. Releasing in early September?)

[Translation Process-Hash Value]

[Modeling screen: Setting Data item]

For sure, there may be some people who would write JavaScript by themselves using [Script step], if it were for "Script for Counting the number of characters". It would be a Script of just five to ten lines. However, even such people will be helpless to write "Script for Generating hash value".

In such cases, all you need to do is to import [Addon XML].

By the way, in [Addon XML]s that have archived in this Workflow-samples, Open source JavaScript are utilized. You will be no need for writing Script of 100 or even 1000 lines. Also it will allow you to reduce the risk of bugs in self-made Script.

It should be noted that I would like you to obtain [Add-ons XML] always from the reliable source when use it. (there is a possibility that Malicious automatic processing has been written.)


= Bundled Addon XML"hash-sha256-addon.xml" (Excerpt)
<?xml version="1.0" encoding="UTF-8"?><service-task-definition> 

<label>SHA256 Hash</label> 

<configs> 
  <config name="conf_SourceText" required="true" form-type="SELECT" select-data-type="STRING"> 
    <label>Input Text</label> 
  </config> 
  <config name="conf_Hash" required="true" form-type="SELECT" select-data-type="STRING"> 
    <label>SHA256 Hash</label> 
  </config> 
</configs> 


<script><![CDATA[ 

//// 
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ 
/* SHA-256 implementation in JavaScript (c) Chris Veness 2002-2014 / MIT Licence */ 
/* */ 
/* - see http://csrc.nist.gov/groups/ST/toolkit/secure_hashing.html */ 
/* http://csrc.nist.gov/groups/ST/toolkit/examples.html */ 
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ 

/** 
* SHA-256 hash function reference implementation. 
* 
* @namespace 
*/ 
var Sha256 = {}; 


/** 
* Generates SHA-256 hash of string. 
* 
* @param {string} msg - String to be hashed 
* @returns {string} Hash of msg as hex character string 
*/ 
Sha256.hash = function(msg) { 
// convert string to UTF-8, as SHA only deals with byte-streams 
msg = msg.utf8Encode(); 

// (Omission) 

}; 

// (Omission)

//// == Config Retrieving == 
var dataDefNumA = configs.get("conf_SourceText"); // SELECT (returns Number) 
var dataDefNumB = configs.get("conf_Hash");  

//// == Data Retrieving == 
var myText = data.get( dataDefNumA ) + ""; 

//// == Calculating == 
var myHash = Sha256.hash( myText ); 

//// == Data Updating == 
retVal.put( dataDefNumB, myHash ); 

]]></script> 

<icon> 
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAA... (Omission)
</icon> 

</service-task-definition> 


[Free Download]
<Similar Models>
<<Related Articles>>

[Japanese Entry (ε’Œζ–‡θ¨˜δΊ‹)]