From ecbb392d28dec324f9ce5ca10a917e8d05e2dbff Mon Sep 17 00:00:00 2001 From: joyfullservice Date: Tue, 9 Mar 2021 12:48:36 -0600 Subject: [PATCH] Add option to select hashing algorithm You can now select from several different hashing algorithms for creating the hashes used by the index to detect changes. SHA256 is the default, and should help those working in a FIPS mode environment. --- Version Control.accda.src/dbs-properties.json | 2 +- .../forms/frmVCSMain.bas | 10 +- .../forms/frmVCSOptions.bas | 731 +++++++++++------- .../modules/clsOptions.bas | 8 + .../modules/modFunctions.bas | 25 + Version Control.accda.src/modules/modHash.bas | 65 +- 6 files changed, 535 insertions(+), 306 deletions(-) diff --git a/Version Control.accda.src/dbs-properties.json b/Version Control.accda.src/dbs-properties.json index 50a948bd..e8ff8a19 100644 --- a/Version Control.accda.src/dbs-properties.json +++ b/Version Control.accda.src/dbs-properties.json @@ -41,7 +41,7 @@ "Type": 10 }, "AppVersion": { - "Value": "3.3.10", + "Value": "3.3.11", "Type": 10 }, "Auto Compact": { diff --git a/Version Control.accda.src/forms/frmVCSMain.bas b/Version Control.accda.src/forms/frmVCSMain.bas index 594d7f69..79b382f8 100644 --- a/Version Control.accda.src/forms/frmVCSMain.bas +++ b/Version Control.accda.src/forms/frmVCSMain.bas @@ -16,10 +16,10 @@ Begin Form Width =9360 DatasheetFontHeight =11 ItemSuffix =32 - Left =3225 - Top =2430 - Right =28545 - Bottom =15015 + Left =-25575 + Top =1710 + Right =-5925 + Bottom =14295 DatasheetGridlinesColor =15132391 RecSrcDt = Begin 0x79e78b777268e540 @@ -2023,7 +2023,7 @@ End Sub ' : is instant when the form is opened. '--------------------------------------------------------------------------------------- ' -Private Sub Form_Load() +Public Sub Form_Load() ' Display version (better performance than bound control) lblVersion.Caption = "Version " & GetVCSVersion() diff --git a/Version Control.accda.src/forms/frmVCSOptions.bas b/Version Control.accda.src/forms/frmVCSOptions.bas index b92d304f..3dead3ed 100644 --- a/Version Control.accda.src/forms/frmVCSOptions.bas +++ b/Version Control.accda.src/forms/frmVCSOptions.bas @@ -15,11 +15,11 @@ Begin Form GridY =24 Width =10080 DatasheetFontHeight =11 - ItemSuffix =217 - Left =7290 - Top =2040 - Right =20025 - Bottom =10035 + ItemSuffix =228 + Left =-25575 + Top =1710 + Right =-5925 + Bottom =14295 DatasheetGridlinesColor =15132391 RecSrcDt = Begin 0x79e78b777268e540 @@ -406,13 +406,14 @@ Begin Form WebImagePaddingTop =9 WebImagePaddingRight =9 WebImagePaddingBottom =9 + Overlaps =1 End Begin Tab OverlapFlags =85 Left =540 Top =1500 Width =9000 - Height =4755 + Height =4740 TabIndex =2 Name ="tabOptions" GridlineColor =10921638 @@ -422,7 +423,7 @@ Begin Form LayoutCachedLeft =540 LayoutCachedTop =1500 LayoutCachedWidth =9540 - LayoutCachedHeight =6255 + LayoutCachedHeight =6240 ThemeFontIndex =1 Shape =1 Gradient =12 @@ -445,7 +446,7 @@ Begin Form Left =615 Top =1980 Width =8850 - Height =4200 + Height =4190 BorderColor =10921638 Name ="pgeGeneral" Caption ="General" @@ -453,44 +454,40 @@ Begin Form LayoutCachedLeft =615 LayoutCachedTop =1980 LayoutCachedWidth =9465 - LayoutCachedHeight =6180 + LayoutCachedHeight =6170 WebImagePaddingLeft =2 WebImagePaddingTop =2 WebImagePaddingRight =2 WebImagePaddingBottom =2 Begin - Begin TextBox + Begin CheckBox OverlapFlags =215 - IMESentenceMode =3 - Left =2700 - Top =2340 - Width =3420 - Height =315 + Left =1020 + Top =4020 BorderColor =10921638 - ForeColor =4210752 - Name ="txtExportFolder" + Name ="chkShowDebug" GridlineColor =10921638 - LayoutCachedLeft =2700 - LayoutCachedTop =2340 - LayoutCachedWidth =6120 - LayoutCachedHeight =2655 + LayoutCachedLeft =1020 + LayoutCachedTop =4020 + LayoutCachedWidth =1280 + LayoutCachedHeight =4260 Begin Begin Label OverlapFlags =215 - Left =1200 - Top =2340 - Width =1380 + Left =1320 + Top =3960 + Width =2640 Height =315 BorderColor =8355711 ForeColor =5324600 - Name ="Label31" - Caption ="Export Folder:" + Name ="Label23" + Caption ="Show Detailed Output" GridlineColor =10921638 - LayoutCachedLeft =1200 - LayoutCachedTop =2340 - LayoutCachedWidth =2580 - LayoutCachedHeight =2655 + LayoutCachedLeft =1320 + LayoutCachedTop =3960 + LayoutCachedWidth =3960 + LayoutCachedHeight =4275 ForeThemeColorIndex =-1 ForeTint =100.0 End @@ -498,33 +495,33 @@ Begin Form End Begin CheckBox OverlapFlags =215 - Left =1260 - Top =2940 + Left =1020 + Top =4440 TabIndex =1 BorderColor =10921638 - Name ="chkUseFastSave" + Name ="chkBreakOnError" GridlineColor =10921638 - LayoutCachedLeft =1260 - LayoutCachedTop =2940 - LayoutCachedWidth =1520 - LayoutCachedHeight =3180 + LayoutCachedLeft =1020 + LayoutCachedTop =4440 + LayoutCachedWidth =1280 + LayoutCachedHeight =4680 Begin Begin Label OverlapFlags =215 - Left =1560 - Top =2880 + Left =1320 + Top =4380 Width =2640 Height =315 BorderColor =8355711 ForeColor =5324600 - Name ="Label25" - Caption ="Use Fast Save" + Name ="Label219" + Caption ="Debug VBA Errors" GridlineColor =10921638 - LayoutCachedLeft =1560 - LayoutCachedTop =2880 - LayoutCachedWidth =4200 - LayoutCachedHeight =3195 + LayoutCachedLeft =1320 + LayoutCachedTop =4380 + LayoutCachedWidth =3960 + LayoutCachedHeight =4695 ForeThemeColorIndex =-1 ForeTint =100.0 End @@ -532,33 +529,34 @@ Begin Form End Begin CheckBox OverlapFlags =215 - Left =1260 - Top =3360 + Left =1020 + Top =4860 TabIndex =2 BorderColor =10921638 - Name ="chkShowDebug" + Name ="chkUseGitIntegration" + OnClick ="[Event Procedure]" GridlineColor =10921638 - LayoutCachedLeft =1260 - LayoutCachedTop =3360 - LayoutCachedWidth =1520 - LayoutCachedHeight =3600 + LayoutCachedLeft =1020 + LayoutCachedTop =4860 + LayoutCachedWidth =1280 + LayoutCachedHeight =5100 Begin Begin Label OverlapFlags =215 - Left =1560 - Top =3300 + Left =1320 + Top =4800 Width =2640 Height =315 BorderColor =8355711 ForeColor =5324600 - Name ="Label23" - Caption ="Show Detailed Output" + Name ="Label163" + Caption ="Use Git Integration" GridlineColor =10921638 - LayoutCachedLeft =1560 - LayoutCachedTop =3300 - LayoutCachedWidth =4200 - LayoutCachedHeight =3615 + LayoutCachedLeft =1320 + LayoutCachedTop =4800 + LayoutCachedWidth =3960 + LayoutCachedHeight =5115 ForeThemeColorIndex =-1 ForeTint =100.0 End @@ -566,67 +564,76 @@ Begin Form End Begin CheckBox OverlapFlags =215 - Left =1260 - Top =3780 + Left =1020 + Top =5280 TabIndex =3 BorderColor =10921638 - Name ="chkStripPublishOption" + Name ="chkShowVCSLegacy" GridlineColor =10921638 - LayoutCachedLeft =1260 - LayoutCachedTop =3780 - LayoutCachedWidth =1520 - LayoutCachedHeight =4020 + LayoutCachedLeft =1020 + LayoutCachedTop =5280 + LayoutCachedWidth =1280 + LayoutCachedHeight =5520 Begin Begin Label OverlapFlags =215 - Left =1560 - Top =3720 + Left =1320 + Top =5220 Width =2640 Height =315 BorderColor =8355711 ForeColor =5324600 - Name ="Label34" - Caption ="Strip out Publish Option" + Name ="Label215" + Caption ="Show Legacy Prompts" GridlineColor =10921638 - LayoutCachedLeft =1560 - LayoutCachedTop =3720 - LayoutCachedWidth =4200 - LayoutCachedHeight =4035 + LayoutCachedLeft =1320 + LayoutCachedTop =5220 + LayoutCachedWidth =3960 + LayoutCachedHeight =5535 ForeThemeColorIndex =-1 ForeTint =100.0 End End End - Begin CheckBox + Begin ComboBox + RowSourceTypeInt =1 OverlapFlags =215 - Left =1260 - Top =4200 + IMESentenceMode =3 + ListWidth =1440 + Left =6720 + Top =4800 + Width =1920 + Height =315 TabIndex =4 BorderColor =10921638 - Name ="chkAggressiveSanitize" + ForeColor =3484194 + Name ="cboHashAlgorithm" + RowSourceType ="Value List" + RowSource ="\"SHA1\";\"SHA256\";\"SHA512\"" GridlineColor =10921638 + AllowValueListEdits =0 - LayoutCachedLeft =1260 - LayoutCachedTop =4200 - LayoutCachedWidth =1520 - LayoutCachedHeight =4440 + LayoutCachedLeft =6720 + LayoutCachedTop =4800 + LayoutCachedWidth =8640 + LayoutCachedHeight =5115 Begin Begin Label OverlapFlags =215 - Left =1560 - Top =4140 - Width =2640 + Left =5040 + Top =4800 + Width =1560 Height =315 BorderColor =8355711 ForeColor =5324600 - Name ="Label40" - Caption ="Aggressive Sanitize" + Name ="Label221" + Caption ="Hash Algorithm:" GridlineColor =10921638 - LayoutCachedLeft =1560 - LayoutCachedTop =4140 - LayoutCachedWidth =4200 - LayoutCachedHeight =4455 + LayoutCachedLeft =5040 + LayoutCachedTop =4800 + LayoutCachedWidth =6600 + LayoutCachedHeight =5115 ForeThemeColorIndex =-1 ForeTint =100.0 End @@ -634,66 +641,181 @@ Begin Form End Begin CheckBox OverlapFlags =215 - Left =1260 - Top =4620 + Left =5040 + Top =5280 TabIndex =5 BorderColor =10921638 - Name ="chkExtractThemeFiles" + Name ="chkUseShortHash" GridlineColor =10921638 - LayoutCachedLeft =1260 - LayoutCachedTop =4620 - LayoutCachedWidth =1520 - LayoutCachedHeight =4860 + LayoutCachedLeft =5040 + LayoutCachedTop =5280 + LayoutCachedWidth =5300 + LayoutCachedHeight =5520 Begin Begin Label OverlapFlags =215 - Left =1560 - Top =4560 + Left =5340 + Top =5220 Width =2640 Height =315 BorderColor =8355711 ForeColor =5324600 - Name ="Label112" - Caption ="Extract Theme Files" + Name ="Label223" + Caption ="Use short hashes in index" GridlineColor =10921638 - LayoutCachedLeft =1560 - LayoutCachedTop =4560 - LayoutCachedWidth =4200 - LayoutCachedHeight =4875 + LayoutCachedLeft =5340 + LayoutCachedTop =5220 + LayoutCachedWidth =7980 + LayoutCachedHeight =5535 ForeThemeColorIndex =-1 ForeTint =100.0 End End End - Begin CheckBox + Begin Label OverlapFlags =215 - Left =4740 - Top =2935 - TabIndex =6 + Left =5040 + Top =3960 + Width =3780 + Height =600 + BorderColor =8355711 + ForeColor =5324600 + Name ="Label224" + Caption ="Some environments may have specific requirements for hashing algorithms." + GridlineColor =10921638 + LayoutCachedLeft =5040 + LayoutCachedTop =3960 + LayoutCachedWidth =8820 + LayoutCachedHeight =4560 + ForeThemeColorIndex =-1 + ForeTint =100.0 + End + Begin Line + LineSlant = NotDefault + BorderWidth =1 + OverlapFlags =87 + Left =960 + Top =3600 + Width =8160 BorderColor =10921638 - Name ="chkSavePrintVars" + Name ="Line226" + GridlineColor =10921638 + HorizontalAnchor =2 + LayoutCachedLeft =960 + LayoutCachedTop =3600 + LayoutCachedWidth =9120 + LayoutCachedHeight =3600 + BorderThemeColorIndex =1 + BorderShade =65.0 + End + Begin Label + OverlapFlags =215 + Left =1020 + Top =2340 + Width =8160 + Height =1095 + BorderColor =8355711 + ForeColor =5324600 + Name ="Label227" + Caption ="Use this form to set your preferred options for exporting and building your data" + "base project to and from source files. Note that you can have different options " + "for different projects, and can save a set of options as default for new project" + "s." + GridlineColor =10921638 + LayoutCachedLeft =1020 + LayoutCachedTop =2340 + LayoutCachedWidth =9180 + LayoutCachedHeight =3435 + ForeThemeColorIndex =-1 + ForeTint =100.0 + End + End + End + Begin Page + OverlapFlags =247 + Left =615 + Top =1980 + Width =8850 + Height =4185 + BorderColor =10921638 + Name ="pgeExport" + Caption ="Export" + GridlineColor =10921638 + LayoutCachedLeft =615 + LayoutCachedTop =1980 + LayoutCachedWidth =9465 + LayoutCachedHeight =6165 + WebImagePaddingLeft =2 + WebImagePaddingTop =2 + WebImagePaddingRight =2 + WebImagePaddingBottom =2 + Begin + Begin TextBox + OverlapFlags =247 + IMESentenceMode =3 + Left =2460 + Top =2340 + Width =3420 + Height =315 + BorderColor =10921638 + ForeColor =4210752 + Name ="txtExportFolder" GridlineColor =10921638 - LayoutCachedLeft =4740 - LayoutCachedTop =2935 - LayoutCachedWidth =5000 - LayoutCachedHeight =3175 + LayoutCachedLeft =2460 + LayoutCachedTop =2340 + LayoutCachedWidth =5880 + LayoutCachedHeight =2655 Begin Begin Label - OverlapFlags =215 - Left =5040 + OverlapFlags =247 + Left =960 + Top =2340 + Width =1380 + Height =315 + BorderColor =8355711 + ForeColor =5324600 + Name ="Label31" + Caption ="Export Folder:" + GridlineColor =10921638 + LayoutCachedLeft =960 + LayoutCachedTop =2340 + LayoutCachedWidth =2340 + LayoutCachedHeight =2655 + ForeThemeColorIndex =-1 + ForeTint =100.0 + End + End + End + Begin CheckBox + OverlapFlags =247 + Left =1020 + Top =2940 + TabIndex =1 + BorderColor =10921638 + Name ="chkUseFastSave" + GridlineColor =10921638 + + LayoutCachedLeft =1020 + LayoutCachedTop =2940 + LayoutCachedWidth =1280 + LayoutCachedHeight =3180 + Begin + Begin Label + OverlapFlags =247 + Left =1320 Top =2880 Width =2640 Height =315 BorderColor =8355711 ForeColor =5324600 - Name ="Label27" - Caption ="Save Report Print Settings" + Name ="Label25" + Caption ="Use Fast Save" GridlineColor =10921638 - LayoutCachedLeft =5040 + LayoutCachedLeft =1320 LayoutCachedTop =2880 - LayoutCachedWidth =7680 + LayoutCachedWidth =3960 LayoutCachedHeight =3195 ForeThemeColorIndex =-1 ForeTint =100.0 @@ -701,33 +823,33 @@ Begin Form End End Begin CheckBox - OverlapFlags =215 - Left =4740 + OverlapFlags =247 + Left =1020 Top =3360 - TabIndex =7 + TabIndex =2 BorderColor =10921638 - Name ="chkSaveQuerySQL" + Name ="chkStripPublishOption" GridlineColor =10921638 - LayoutCachedLeft =4740 + LayoutCachedLeft =1020 LayoutCachedTop =3360 - LayoutCachedWidth =5000 + LayoutCachedWidth =1280 LayoutCachedHeight =3600 Begin Begin Label - OverlapFlags =215 - Left =5040 + OverlapFlags =247 + Left =1320 Top =3300 Width =2640 Height =315 BorderColor =8355711 ForeColor =5324600 - Name ="Label29" - Caption ="Save Query SQL" + Name ="Label34" + Caption ="Strip out Publish Option" GridlineColor =10921638 - LayoutCachedLeft =5040 + LayoutCachedLeft =1320 LayoutCachedTop =3300 - LayoutCachedWidth =7680 + LayoutCachedWidth =3960 LayoutCachedHeight =3615 ForeThemeColorIndex =-1 ForeTint =100.0 @@ -735,33 +857,33 @@ Begin Form End End Begin CheckBox - OverlapFlags =215 - Left =4740 + OverlapFlags =247 + Left =1020 Top =3780 - TabIndex =8 + TabIndex =3 BorderColor =10921638 - Name ="chkSaveTableSQL" + Name ="chkAggressiveSanitize" GridlineColor =10921638 - LayoutCachedLeft =4740 + LayoutCachedLeft =1020 LayoutCachedTop =3780 - LayoutCachedWidth =5000 + LayoutCachedWidth =1280 LayoutCachedHeight =4020 Begin Begin Label - OverlapFlags =215 - Left =5040 + OverlapFlags =247 + Left =1320 Top =3720 Width =2640 Height =315 BorderColor =8355711 ForeColor =5324600 - Name ="Label38" - Caption ="Save Table SQL" + Name ="Label40" + Caption ="Aggressive Sanitize" GridlineColor =10921638 - LayoutCachedLeft =5040 + LayoutCachedLeft =1320 LayoutCachedTop =3720 - LayoutCachedWidth =7680 + LayoutCachedWidth =3960 LayoutCachedHeight =4035 ForeThemeColorIndex =-1 ForeTint =100.0 @@ -769,107 +891,162 @@ Begin Form End End Begin CheckBox - OverlapFlags =215 - Left =4740 + OverlapFlags =247 + Left =1020 Top =4200 - TabIndex =9 + TabIndex =4 BorderColor =10921638 - Name ="chkUseGitIntegration" - OnClick ="[Event Procedure]" + Name ="chkExtractThemeFiles" GridlineColor =10921638 - LayoutCachedLeft =4740 + LayoutCachedLeft =1020 LayoutCachedTop =4200 - LayoutCachedWidth =5000 + LayoutCachedWidth =1280 LayoutCachedHeight =4440 Begin Begin Label - OverlapFlags =215 - Left =5040 + OverlapFlags =247 + Left =1320 Top =4140 Width =2640 Height =315 BorderColor =8355711 ForeColor =5324600 - Name ="Label163" - Caption ="Use Git Integration" + Name ="Label112" + Caption ="Extract Theme Files" GridlineColor =10921638 - LayoutCachedLeft =5040 + LayoutCachedLeft =1320 LayoutCachedTop =4140 - LayoutCachedWidth =7680 + LayoutCachedWidth =3960 LayoutCachedHeight =4455 ForeThemeColorIndex =-1 ForeTint =100.0 End End End - Begin ComboBox - LimitToList = NotDefault - RowSourceTypeInt =1 - OverlapFlags =215 - IMESentenceMode =3 - ColumnCount =2 - ListWidth =1440 - Left =7080 - Top =5100 - Width =1920 - Height =315 - TabIndex =10 + Begin CheckBox + OverlapFlags =247 + Left =4500 + Top =2935 + TabIndex =5 BorderColor =10921638 - ForeColor =3484194 - Name ="cboSecurity" - RowSourceType ="Value List" - RowSource ="1;\"Encrypt\";2;\"Remove\";3;\"None\"" - ColumnWidths ="0" - OnClick ="[Event Procedure]" + Name ="chkSavePrintVars" GridlineColor =10921638 - LayoutCachedLeft =7080 - LayoutCachedTop =5100 - LayoutCachedWidth =9000 - LayoutCachedHeight =5415 + LayoutCachedLeft =4500 + LayoutCachedTop =2935 + LayoutCachedWidth =4760 + LayoutCachedHeight =3175 Begin Begin Label - OverlapFlags =215 - Left =6060 - Top =5100 - Width =900 - Height =320 + OverlapFlags =247 + Left =4800 + Top =2880 + Width =2640 + Height =315 BorderColor =8355711 ForeColor =5324600 - Name ="Col1_Label" - Caption ="Security:" + Name ="Label27" + Caption ="Save Report Print Settings" GridlineColor =10921638 - LayoutCachedLeft =6060 - LayoutCachedTop =5100 - LayoutCachedWidth =6960 - LayoutCachedHeight =5420 + LayoutCachedLeft =4800 + LayoutCachedTop =2880 + LayoutCachedWidth =7440 + LayoutCachedHeight =3195 + ForeThemeColorIndex =-1 + ForeTint =100.0 + End + End + End + Begin CheckBox + OverlapFlags =247 + Left =4500 + Top =3360 + TabIndex =6 + BorderColor =10921638 + Name ="chkSaveQuerySQL" + GridlineColor =10921638 + + LayoutCachedLeft =4500 + LayoutCachedTop =3360 + LayoutCachedWidth =4760 + LayoutCachedHeight =3600 + Begin + Begin Label + OverlapFlags =247 + Left =4800 + Top =3300 + Width =2640 + Height =315 + BorderColor =8355711 + ForeColor =5324600 + Name ="Label29" + Caption ="Save Query SQL" + GridlineColor =10921638 + LayoutCachedLeft =4800 + LayoutCachedTop =3300 + LayoutCachedWidth =7440 + LayoutCachedHeight =3615 + ForeThemeColorIndex =-1 + ForeTint =100.0 + End + End + End + Begin CheckBox + OverlapFlags =247 + Left =4500 + Top =3780 + TabIndex =7 + BorderColor =10921638 + Name ="chkSaveTableSQL" + GridlineColor =10921638 + + LayoutCachedLeft =4500 + LayoutCachedTop =3780 + LayoutCachedWidth =4760 + LayoutCachedHeight =4020 + Begin + Begin Label + OverlapFlags =247 + Left =4800 + Top =3720 + Width =2640 + Height =315 + BorderColor =8355711 + ForeColor =5324600 + Name ="Label38" + Caption ="Save Table SQL" + GridlineColor =10921638 + LayoutCachedLeft =4800 + LayoutCachedTop =3720 + LayoutCachedWidth =7440 + LayoutCachedHeight =4035 ForeThemeColorIndex =-1 ForeTint =100.0 End End End Begin TextBox - OverlapFlags =215 + OverlapFlags =247 IMESentenceMode =3 - Left =3540 + Left =3300 Top =5100 Width =1980 Height =315 - TabIndex =11 + TabIndex =8 BorderColor =10921638 ForeColor =4210752 Name ="txtRunBeforeExport" GridlineColor =10921638 - LayoutCachedLeft =3540 + LayoutCachedLeft =3300 LayoutCachedTop =5100 - LayoutCachedWidth =5520 + LayoutCachedWidth =5280 LayoutCachedHeight =5415 Begin Begin Label - OverlapFlags =215 - Left =1260 + OverlapFlags =247 + Left =1020 Top =5100 Width =2205 Height =315 @@ -878,9 +1055,9 @@ Begin Form Name ="Label44" Caption ="Run Sub Before Export:" GridlineColor =10921638 - LayoutCachedLeft =1260 + LayoutCachedLeft =1020 LayoutCachedTop =5100 - LayoutCachedWidth =3465 + LayoutCachedWidth =3225 LayoutCachedHeight =5415 ForeThemeColorIndex =-1 ForeTint =100.0 @@ -888,26 +1065,26 @@ Begin Form End End Begin TextBox - OverlapFlags =215 + OverlapFlags =247 IMESentenceMode =3 - Left =3540 + Left =3300 Top =5520 Width =1980 Height =315 - TabIndex =12 + TabIndex =9 BorderColor =10921638 ForeColor =4210752 Name ="txtRunAfterExport" GridlineColor =10921638 - LayoutCachedLeft =3540 + LayoutCachedLeft =3300 LayoutCachedTop =5520 - LayoutCachedWidth =5520 + LayoutCachedWidth =5280 LayoutCachedHeight =5835 Begin Begin Label - OverlapFlags =215 - Left =1260 + OverlapFlags =247 + Left =1020 Top =5520 Width =2055 Height =315 @@ -916,22 +1093,67 @@ Begin Form Name ="Label48" Caption ="Run Sub After Export:" GridlineColor =10921638 - LayoutCachedLeft =1260 + LayoutCachedLeft =1020 LayoutCachedTop =5520 - LayoutCachedWidth =3315 + LayoutCachedWidth =3075 LayoutCachedHeight =5835 ForeThemeColorIndex =-1 ForeTint =100.0 End End End + Begin ComboBox + LimitToList = NotDefault + RowSourceTypeInt =1 + OverlapFlags =247 + IMESentenceMode =3 + ColumnCount =2 + ListWidth =1440 + Left =7020 + Top =5100 + Width =1920 + Height =315 + TabIndex =10 + BorderColor =10921638 + ForeColor =3484194 + Name ="cboSecurity" + RowSourceType ="Value List" + RowSource ="1;\"Encrypt\";2;\"Remove\";3;\"None\"" + ColumnWidths ="0" + GridlineColor =10921638 + + LayoutCachedLeft =7020 + LayoutCachedTop =5100 + LayoutCachedWidth =8940 + LayoutCachedHeight =5415 + Begin + Begin Label + OverlapFlags =247 + Left =6000 + Top =5100 + Width =900 + Height =320 + BorderColor =8355711 + ForeColor =5324600 + Name ="Col1_Label" + Caption ="Security:" + GridlineColor =10921638 + LayoutCachedLeft =6000 + LayoutCachedTop =5100 + LayoutCachedWidth =6900 + LayoutCachedHeight =5420 + ForeThemeColorIndex =-1 + ForeTint =100.0 + End + End + End Begin CommandButton FontUnderline = NotDefault - OverlapFlags =215 - Left =6960 + OverlapFlags =247 + Left =6900 Top =5520 Width =2160 - TabIndex =13 + TabIndex =11 ForeColor =12673797 Name ="cmdExplainOptions" Caption ="Explain options..." @@ -976,9 +1198,9 @@ Begin Form End BackStyle =0 - LayoutCachedLeft =6960 + LayoutCachedLeft =6900 LayoutCachedTop =5520 - LayoutCachedWidth =9120 + LayoutCachedWidth =9060 LayoutCachedHeight =5880 PictureCaptionArrangement =4 ForeThemeColorIndex =10 @@ -1003,11 +1225,10 @@ Begin Form WebImagePaddingTop =2 WebImagePaddingRight =2 WebImagePaddingBottom =2 - Overlaps =1 End Begin Label - OverlapFlags =215 - Left =6360 + OverlapFlags =247 + Left =6120 Top =2400 Width =2160 Height =240 @@ -1017,15 +1238,15 @@ Begin Form Name ="Label46" Caption ="(Blank for default)" GridlineColor =10921638 - LayoutCachedLeft =6360 + LayoutCachedLeft =6120 LayoutCachedTop =2400 - LayoutCachedWidth =8520 + LayoutCachedWidth =8280 LayoutCachedHeight =2640 End Begin Label FontUnderline = NotDefault - OverlapFlags =215 - Left =7740 + OverlapFlags =247 + Left =7500 Top =2880 Width =900 Height =240 @@ -1035,12 +1256,11 @@ Begin Form ForeColor =12673797 Name ="lblPrintSettingsOptions" Caption ="Options..." - OnClick ="[Event Procedure]" HyperlinkAddress ="#" GridlineColor =10921638 - LayoutCachedLeft =7740 + LayoutCachedLeft =7500 LayoutCachedTop =2880 - LayoutCachedWidth =8640 + LayoutCachedWidth =8400 LayoutCachedHeight =3120 BackThemeColorIndex =-1 BorderThemeColorIndex =-1 @@ -1048,40 +1268,6 @@ Begin Form ForeThemeColorIndex =10 ForeTint =100.0 End - Begin CheckBox - OverlapFlags =215 - Left =4740 - Top =4620 - TabIndex =14 - BorderColor =10921638 - Name ="chkShowVCSLegacy" - GridlineColor =10921638 - - LayoutCachedLeft =4740 - LayoutCachedTop =4620 - LayoutCachedWidth =5000 - LayoutCachedHeight =4860 - Begin - Begin Label - OverlapFlags =215 - Left =5040 - Top =4560 - Width =2640 - Height =315 - BorderColor =8355711 - ForeColor =5324600 - Name ="Label215" - Caption ="Show Legacy Prompts" - GridlineColor =10921638 - LayoutCachedLeft =5040 - LayoutCachedTop =4560 - LayoutCachedWidth =7680 - LayoutCachedHeight =4875 - ForeThemeColorIndex =-1 - ForeTint =100.0 - End - End - End End End Begin Page @@ -1090,7 +1276,7 @@ Begin Form Left =615 Top =1980 Width =8850 - Height =4200 + Height =4185 BorderColor =10921638 Name ="pgePrinterSettings" Caption ="Printer Settings" @@ -1098,7 +1284,7 @@ Begin Form LayoutCachedLeft =615 LayoutCachedTop =1980 LayoutCachedWidth =9465 - LayoutCachedHeight =6180 + LayoutCachedHeight =6165 WebImagePaddingLeft =2 WebImagePaddingTop =2 WebImagePaddingRight =2 @@ -1828,7 +2014,7 @@ Begin Form Left =615 Top =1980 Width =8850 - Height =4200 + Height =4185 BorderColor =10921638 Name ="pgeTable" Caption ="Table Data" @@ -1836,7 +2022,7 @@ Begin Form LayoutCachedLeft =615 LayoutCachedTop =1980 LayoutCachedWidth =9465 - LayoutCachedHeight =6180 + LayoutCachedHeight =6165 WebImagePaddingLeft =2 WebImagePaddingTop =2 WebImagePaddingRight =2 @@ -2202,7 +2388,7 @@ Begin Form Left =615 Top =1980 Width =8850 - Height =4200 + Height =4185 BorderColor =10921638 Name ="pgeBuild" Caption ="Build" @@ -2210,7 +2396,7 @@ Begin Form LayoutCachedLeft =615 LayoutCachedTop =1980 LayoutCachedWidth =9465 - LayoutCachedHeight =6180 + LayoutCachedHeight =6165 WebImagePaddingLeft =2 WebImagePaddingTop =2 WebImagePaddingRight =2 @@ -2336,7 +2522,7 @@ Begin Form Left =615 Top =1980 Width =8850 - Height =4200 + Height =4185 BorderColor =10921638 Name ="pgeGitIntegration" Caption ="Git Integration" @@ -2344,7 +2530,7 @@ Begin Form LayoutCachedLeft =615 LayoutCachedTop =1980 LayoutCachedWidth =9465 - LayoutCachedHeight =6180 + LayoutCachedHeight =6165 WebImagePaddingLeft =2 WebImagePaddingTop =2 WebImagePaddingRight =2 @@ -2700,7 +2886,7 @@ Begin Form Left =615 Top =1980 Width =8850 - Height =4200 + Height =4185 BorderColor =10921638 Name ="pgeEncrypt" Caption ="Encryption" @@ -2708,7 +2894,7 @@ Begin Form LayoutCachedLeft =615 LayoutCachedTop =1980 LayoutCachedWidth =9465 - LayoutCachedHeight =6180 + LayoutCachedHeight =6165 WebImagePaddingLeft =2 WebImagePaddingTop =2 WebImagePaddingRight =2 @@ -2974,7 +3160,7 @@ Begin Form Left =615 Top =1980 Width =8850 - Height =4200 + Height =4185 BorderColor =10921638 Name ="pgeSettings" Caption ="Settings" @@ -2982,7 +3168,7 @@ Begin Form LayoutCachedLeft =615 LayoutCachedTop =1980 LayoutCachedWidth =9465 - LayoutCachedHeight =6180 + LayoutCachedHeight =6165 WebImagePaddingLeft =2 WebImagePaddingTop =2 WebImagePaddingRight =2 @@ -4014,6 +4200,9 @@ Private Sub cmdSaveAndClose_Click() Options.SaveOptionsForProject DoCmd.Close acForm, Me.Name + ' Update main form if options changed. + If IsLoaded(acForm, "frmVCSMain") Then Form_frmVCSMain.Form_Load + End Sub diff --git a/Version Control.accda.src/modules/clsOptions.bas b/Version Control.accda.src/modules/clsOptions.bas index e1391bf3..a7e3d045 100644 --- a/Version Control.accda.src/modules/clsOptions.bas +++ b/Version Control.accda.src/modules/clsOptions.bas @@ -34,6 +34,9 @@ Public RunAfterBuild As String Public Security As eSecurity Public KeyName As String Public ShowVCSLegacy As Boolean +Public HashAlgorithm As String +Public UseShortHash As Boolean +Public BreakOnError As Boolean ' Constants for enum values ' (These values are not permanently stored and @@ -82,6 +85,8 @@ Public Sub LoadDefaults() .Security = esNone .KeyName = modEncrypt.DefaultKeyName .ShowVCSLegacy = True + .HashAlgorithm = "SHA256" + .UseShortHash = True ' Table data export Set .TablesToExportData = New Dictionary @@ -527,6 +532,9 @@ Private Sub Class_Initialize() .Add "Security" .Add "KeyName" .Add "ShowVCSLegacy" + .Add "HashAlgorithm" + .Add "UseShortHash" + .Add "BreakOnError" End With ' Load default values diff --git a/Version Control.accda.src/modules/modFunctions.bas b/Version Control.accda.src/modules/modFunctions.bas index 9b60163d..e775581d 100644 --- a/Version Control.accda.src/modules/modFunctions.bas +++ b/Version Control.accda.src/modules/modFunctions.bas @@ -589,4 +589,29 @@ Public Function BuildPath2(ParamArray Segments()) Next lngPart BuildPath2 = .GetStr End With +End Function + + +'--------------------------------------------------------------------------------------- +' Procedure : Nz2 +' Author : Adam Waller +' Date : 2/18/2021 +' Purpose : Extend the NZ function to also include 0 or empty string. +'--------------------------------------------------------------------------------------- +' +Public Function Nz2(varValue, Optional varIfNull) As Variant + Select Case varValue + Case vbNullString, 0 + If IsMissing(varIfNull) Then + Nz2 = vbNullString + Else + Nz2 = varIfNull + End If + Case Else + If IsNull(varValue) Then + Nz2 = varIfNull + Else + Nz2 = varValue + End If + End Select End Function \ No newline at end of file diff --git a/Version Control.accda.src/modules/modHash.bas b/Version Control.accda.src/modules/modHash.bas index 8dd37619..3bb140d4 100644 --- a/Version Control.accda.src/modules/modHash.bas +++ b/Version Control.accda.src/modules/modHash.bas @@ -63,7 +63,7 @@ Public Declare PtrSafe Function BCryptGetProperty Lib "BCrypt.dll" ( _ Private Const ModuleName As String = "modHash" -Private Function NGHash(pData As LongPtr, lenData As Long, Optional HashingAlgorithm As String = "SHA1") As Byte() +Private Function NGHash(pData As LongPtr, lenData As Long, Optional HashingAlgorithm As String = "SHA256") As Byte() 'Erik A, 2019, adapted by Adam Waller 'Hash data by using the Next Generation Cryptography API @@ -90,11 +90,11 @@ Private Function NGHash(pData As LongPtr, lenData As Long, Optional HashingAlgor ReDim bHashObject(0 To Length - 1) 'Determine digest size, allocate memory - Dim hashLength As Long + Dim HashLength As Long cmd = "HashDigestLength" & vbNullChar - If BCryptGetProperty(hAlg, StrPtr(cmd), hashLength, LenB(hashLength), 0, 0) <> 0 Then GoTo ErrHandler + If BCryptGetProperty(hAlg, StrPtr(cmd), HashLength, LenB(HashLength), 0, 0) <> 0 Then GoTo ErrHandler Dim bHash() As Byte - ReDim bHash(0 To hashLength - 1) + ReDim bHash(0 To HashLength - 1) 'Create hash object Dim hHash As LongPtr @@ -102,7 +102,7 @@ Private Function NGHash(pData As LongPtr, lenData As Long, Optional HashingAlgor 'Hash data If BCryptHashData(hHash, ByVal pData, lenData) <> 0 Then GoTo ErrHandler - If BCryptFinishHash(hHash, bHash(0), hashLength, 0) <> 0 Then GoTo ErrHandler + If BCryptFinishHash(hHash, bHash(0), HashLength, 0) <> 0 Then GoTo ErrHandler 'Return result NGHash = bHash @@ -149,13 +149,13 @@ End Function ' Procedure : GetStringHash ' Author : Adam Waller ' Date : 11/30/2020 -' Purpose : Convert string to byte array, and return a Sha1 hash. +' Purpose : Convert string to byte array, and return a hash. '--------------------------------------------------------------------------------------- ' -Public Function GetStringHash(strText As String, Optional intLength As Integer = 7) As String +Public Function GetStringHash(strText As String) As String Dim bteText() As Byte bteText = strText - GetStringHash = Sha1(bteText, intLength) + GetStringHash = GetHash(bteText) End Function @@ -163,11 +163,11 @@ End Function ' Procedure : GetFileHash ' Author : Adam Waller ' Date : 11/30/2020 -' Purpose : Return a Sha1 hash from a file +' Purpose : Return a hash from a file '--------------------------------------------------------------------------------------- ' -Public Function GetFileHash(strPath As String, Optional intLength As Integer = 7) As String - GetFileHash = Sha1(GetFileBytes(strPath), intLength) +Public Function GetFileHash(strPath As String) As String + GetFileHash = GetHash(GetFileBytes(strPath)) End Function @@ -178,41 +178,48 @@ End Function ' Purpose : Wrapper to get a hash from a dictionary object (converted to json) '--------------------------------------------------------------------------------------- ' -Public Function GetDictionaryHash(dSource As Dictionary, Optional intLength As Integer = 7) As String - GetDictionaryHash = GetStringHash(ConvertToJson(dSource), intLength) +Public Function GetDictionaryHash(dSource As Dictionary) As String + GetDictionaryHash = GetStringHash(ConvertToJson(dSource)) End Function '--------------------------------------------------------------------------------------- -' Procedure : Sha1 +' Procedure : GetHash ' Author : Adam Waller ' Date : 11/30/2020 -' Purpose : Create a Sha1 hash of the byte array +' Purpose : Create a hash from the byte array '--------------------------------------------------------------------------------------- ' -Private Function Sha1(bteContent() As Byte, Optional intLength As Integer) As String +Private Function GetHash(bteContent() As Byte) As String Dim objEnc As Object - Dim bteSha1 As Variant - Dim strSha1 As String + Dim bteHash As Variant + Dim strHash As String Dim intPos As Integer + Dim intLength As Integer + Dim strAlgorithm As String + + ' Get hashing options + strAlgorithm = Nz2(Options.HashAlgorithm, "SHA256") + If Options.UseShortHash Then intLength = 7 - Perf.OperationStart "Compute SHA1" - bteSha1 = HashBytes(bteContent, "SHA1") + ' Start performance timer and compute the hash + Perf.OperationStart "Compute " & strAlgorithm + bteHash = HashBytes(bteContent, strAlgorithm) ' Create string buffer to avoid concatenation - strSha1 = Space(LenB(bteSha1) * 2) + strHash = Space(LenB(bteHash) * 2) - ' Convert full sha1 to hexidecimal string - For intPos = 1 To LenB(bteSha1) - Mid$(strSha1, (intPos * 2) - 1, 2) = LCase(Right("0" & Hex(AscB(MidB(bteSha1, intPos, 1))), 2)) + ' Convert full hash to hexidecimal string + For intPos = 1 To LenB(bteHash) + Mid$(strHash, (intPos * 2) - 1, 2) = LCase(Right("0" & Hex(AscB(MidB(bteHash, intPos, 1))), 2)) Next ' Return hash, truncating if needed. - If intLength > 0 And intLength < Len(strSha1) Then - Sha1 = Left$(strSha1, intLength) + If intLength > 0 And intLength < Len(strHash) Then + GetHash = Left$(strHash, intLength) Else - Sha1 = strSha1 + GetHash = strHash End If Perf.OperationEnd @@ -223,7 +230,7 @@ End Function ' Procedure : GetCodeModuleHash ' Author : Adam Waller ' Date : 11/30/2020 -' Purpose : Return a Sha1 hash of the VBA code module behind an object. +' Purpose : Return a hash from the VBA code module behind an object. '--------------------------------------------------------------------------------------- ' Public Function GetCodeModuleHash(intType As eDatabaseComponentType, strName As String, Optional intLength As Integer = 7) As String @@ -261,7 +268,7 @@ Public Function GetCodeModuleHash(intType As eDatabaseComponentType, strName As ' Output the hash If Not cmpItem Is Nothing Then With cmpItem.CodeModule - strHash = GetStringHash(.Lines(1, 999999), intLength) + strHash = GetStringHash(.Lines(1, 999999)) End With End If