我正试图与埃及EInvoicing,EReceipt集成,我应该生成收据UUID,并做到这一点,我应该按照指示在此链接https://sdk.invoicing.eta.gov.eg/receiptissuancefaq/#how-to-generate-receipt-uuid我做了步骤1,2,3,4但对于步骤5,我应该使用SHA256创建一个规范化文本的哈希值,所以我用这个sql
SELECT STANDARD_HASH(
('"HEADER""DATETIMEISSUED""2023-05-25T00:34:00Z""RECEIPTNUMBER""001""UUID""""PREVIOUSUUID""""REFERENCEOLDUUID""""CURRENCY""EGP""EXCHANGERATE""0""SORDERNAMECODE""sOrderNameCode""ORDERDELIVERYMODE""""GROSSWEIGHT""6.58""NETWEIGHT""6.89""DOCUMENTTYPE""RECEIPTTYPE""S""TYPEVERSION""1.2""SELLER""RIN""100334776""COMPANYTRADENAME""Minapharm""BRANCHCODE""0""BRANCHADDRESS""COUNTRY""EG""GOVERNATE""cairo""REGIONCITY""city center""STREET""16 street""BUILDINGNUMBER""14BN""POSTALCODE""74235""FLOOR""1F""ROOM""3R""LANDMARK""tahrir square""ADDITIONALINFORMATION""talaat harb street""DEVICESERIALNUMBER""Sofy123""SYNDICATELICENSENUMBER""1000056""ACTIVITYCODE""4620""BUYER""TYPE""F""ID""313717919""NAME""taxpayer 1""MOBILENUMBER""+201020567462""PAYMENTNUMBER""987654""ITEMDATA""ITEMDATA""INTERNALCODE""880609""DESCRIPTION""Samsung A02 32GB_LTE_BLACK_DS_SM-A022FZKDMEB_A022 _ A022_SM-A022FZKDMEB""ITEMTYPE""GS1""ITEMCODE""037000401629""UNITTYPE""EA""QUANTITY""35""UNITPRICE""247.96000""NETSALE""7810.74000""TOTALSALE""8678.60000""TOTAL""8887.04360""COMMERCIALDISCOUNTDATA""COMMERCIALDISCOUNTDATA""AMOUNT""867.86000""DESCRIPTION""XYZ""ITEMDISCOUNTDATA""ITEMDISCOUNTDATA""AMOUNT""10""DESCRIPTION""ABC""ITEMDISCOUNTDATA""AMOUNT""10""DESCRIPTION""XYZ""VALUEDIFFERENCE""20""TAXABLEITEMS""TAXABLEITEMS""TAXTYPE""T1""AMOUNT""1096.30360""SUBTYPE""V009""RATE""14""TOTALSALES""8678.60000""TOTALCOMMERCIALDISCOUNT""867.86000""TOTALITEMSDISCOUNT""20""EXTRARECEIPTDISCOUNTDATA""EXTRARECEIPTDISCOUNTDATA""AMOUNT""0""DESCRIPTION""ABC""NETAMOUNT""7810.74000""FEESAMOUNT""0""TOTALAMOUNT""8887.04360""TAXTOTALS""TAXTOTALS""TAXTYPE""T1""AMOUNT""1096.30360""PAYMENTMETHOD""C""ADJUSTMENT""0""CONTRACTOR""NAME""contractor1""AMOUNT""2.563""RATE""2.3""BENEFICIARY""AMOUNT""20.569""RATE""2.147"')
,'SHA256') as standard_hash_SHA256
FROM DUAL;
结果是E1F20DB1DB2C79B84C823CFB0F9B8C89BF3FAD367CD732CEFB3E9AEAFD2E3F8B
这里我有两个问题:第一个问题:在第6步中,他们说“将哈希值从32字节的数组转换为64个字符的十六进制字符串”,但当我运行上一个SQL时,我已经得到了64个字符。SQL语句的结果应为65e952fae3e93f64441433bb72eaa6d4d038945fc132e6e8ae3d3444c5d26a50
使用LiveSQL测试用例:https://livesql.oracle.com/apex/livesql/s/o8fmjsynr77byq5fg1vkelwcg
所以请告诉我,我必须做什么才能为上面SQL中的数据获得相同的uuid结果
1条答案
按热度按时间uurv41yg1#
在第6步中,他们说“将哈希值从32字节的数组转换为64个字符的十六进制字符串”,但当我运行上一个SQL时,我已经得到了64个字符
不你没有The STANDARD_HASH function返回RAW值。一些客户端,包括SQL Live,似乎显示文本等效项。在db<>fiddle中,该值显示为
0xE1F20D...
,带有0x
前缀,表示它是一个已解码的十六进制值。| STANDARD_HASH_SHA256|
| - -----|
| 0xE1F20DB1DB2C79B84C823CFB0F9B8C89BF3FAD367CD732CEFB3E9AEAFD2E3F8B|
您可以使用the RAWTOHEX function将其转换为字符串:
| STANDARD_HASH_SHA256|
| - -----|
| E1F20DB1DB2C79B84C823CFB0F9B8C89BF3FAD367CD732CEFB3E9AEAFD2E3F8B|
如果大小写很重要,可以将其转换为小写:
| STANDARD_HASH_SHA256|
| - -----|
| e1f20db1db2c79b84c823cfb0f9b8c89bf3fad367cd732cefb3e9aeafd2e3f8b|
fiddle